Skip to content

Commit b1e8f5f

Browse files
committed
fixup! Make string marshaling either lax or strict
1 parent 69219db commit b1e8f5f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

LibGit2Sharp/CheckoutCallbacks.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private void OnGitCheckoutProgress(IntPtr str, UIntPtr completedSteps, UIntPtr t
8686
if (onCheckoutProgress != null)
8787
{
8888
// Convert null strings into empty strings.
89-
FilePath path = (str != IntPtr.Zero) ? LaxFilePathMarshaler.FromNative(str) : FilePath.Empty;
89+
FilePath path = LaxFilePathMarshaler.FromNative(str) ?? FilePath.Empty;
9090

9191
onCheckoutProgress(path.Native, (int)completedSteps, (int)totalSteps);
9292
}
@@ -103,8 +103,7 @@ private int OnGitCheckoutNotify(
103103
int result = 0;
104104
if (this.onCheckoutNotify != null)
105105
{
106-
FilePath path = (pathPtr != IntPtr.Zero) ?
107-
LaxFilePathMarshaler.FromNative(pathPtr) : FilePath.Empty;
106+
FilePath path = LaxFilePathMarshaler.FromNative(pathPtr) ?? FilePath.Empty;
108107
result = onCheckoutNotify(path.Native, why) ? 0 : 1;
109108
}
110109

LibGit2Sharp/MatchedPathsAggregator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class MatchedPathsAggregator : IEnumerable<FilePath>
1919
internal int OnGitDiffNotify(IntPtr diffListSoFar, IntPtr deltaToAdd, IntPtr matchedPathspec, IntPtr payload)
2020
{
2121
// Convert null strings into empty strings.
22-
var path = (matchedPathspec != IntPtr.Zero) ? LaxFilePathMarshaler.FromNative(matchedPathspec) : FilePath.Empty;
22+
var path = LaxFilePathMarshaler.FromNative(matchedPathspec) ?? FilePath.Empty;
2323

2424
if (matchedPaths.Contains(path))
2525
{

0 commit comments

Comments
 (0)