diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-12-05 19:53:05 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-05 11:31:39 -0800 |
commit | d4cd4a96eae4a970c161c8b99c9f1cf9e02d9fbf (patch) | |
tree | d8c92ef3db2134386a2a10f31afaca01c425e48b /core | |
parent | 4dbbf1ff27daccd1b2abc9a2257cc2089ac9b173 (diff) | |
download | subsurface-d4cd4a96eae4a970c161c8b99c9f1cf9e02d9fbf.tar.gz |
Gracefully handle cloud authentication failure in verbose mode
If the credential functions return GIT_EUSER, a call to git_remote_fetch
fails, but giterr_last() may return NULL. This led to a crash in
verbose mode.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/git-access.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/git-access.c b/core/git-access.c index 40ee25600..db35a3083 100644 --- a/core/git-access.c +++ b/core/git-access.c @@ -607,7 +607,9 @@ int sync_with_remote(git_repository *repo, const char *remote, const char *branc else report_error("Unable to fetch remote '%s'", remote); if (verbose) - fprintf(stderr, "remote fetch failed (%s)\n", giterr_last()->message); + // If we returned GIT_EUSER during authentication, giterr_last() returns NULL + fprintf(stderr, "remote fetch failed (%s)\n", + giterr_last() ? giterr_last()->message : "authentication failed"); error = 0; } else { error = check_remote_status(repo, origin, remote, branch, rt); |