Skip to content
Browse files

Different strategy for handling null errors

  • Loading branch information...
1 parent 5e28e01 commit a820e0ef17902c463bc5cf84038bb371844b9b3b @tclem committed Jun 21, 2012
Showing with 5 additions and 2 deletions.
  1. +4 −1 LibGit2Sharp/Core/GitErrorMarshaler.cs
  2. +1 −1 LibGit2Sharp/LibGit2SharpException.cs
View
5 LibGit2Sharp/Core/GitErrorMarshaler.cs
@@ -13,7 +13,10 @@ public void CleanUpManagedData(object managedObj)
public void CleanUpNativeData(IntPtr pNativeData)
{
- Marshal.FreeHGlobal(pNativeData);
+ if (pNativeData != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(pNativeData);
+ }
}
public int GetNativeDataSize()
View
2 LibGit2Sharp/LibGit2SharpException.cs
@@ -58,7 +58,7 @@ public LibGit2SharpException()
/// </summary>
public LibGit2SharpException(GitErrorCode code, GitErrorCategory category, string message) : base(message)
{
- Data["libgit2.code"] = this.code = code;
+ Data["libgit2.code"] = this.code = code;
Data["libgit2.class"] = this.category = category;
isLibraryError = true;
}

0 comments on commit a820e0e

Please sign in to comment.
Something went wrong with that request. Please try again.