Skip to content

Commit 4f68818

Browse files
committed
Merge commit 'refs/pull/1239/head' of github.com:libgit2/libgit2sharp
2 parents 78a0f4b + 4f7e628 commit 4f68818

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

LibGit2Sharp/RemoteCallbacks.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,21 @@ private int GitCredentialHandler(
285285
types |= SupportedCredentialTypes.Default;
286286
}
287287

288-
var cred = CredentialsProvider(url, username, types);
289-
290-
return cred.GitCredentialHandler(out ptr);
288+
ptr = IntPtr.Zero;
289+
try
290+
{
291+
var cred = CredentialsProvider(url, username, types);
292+
if (cred == null)
293+
{
294+
return (int)GitErrorCode.PassThrough;
295+
}
296+
return cred.GitCredentialHandler(out ptr);
297+
}
298+
catch (Exception exception)
299+
{
300+
Proxy.giterr_set_str(GitErrorCategory.Callback, exception);
301+
return (int)GitErrorCode.Error;
302+
}
291303
}
292304

293305
private int GitCertificateCheck(IntPtr certPtr, int valid, IntPtr cHostname, IntPtr payload)

0 commit comments

Comments
 (0)