summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorFraser Tweedale <frase@frase.id.au>2013-01-31 12:22:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-31 16:09:53 (GMT)
commit1d2c14df1605a05118524b2382402d689f69d737 (patch)
treef6edee51fadd210a4483ed223bfaf790e5eccbc3 /transport.c
parentf25950f3475e263ed6c8f0797bb058ba6444f85e (diff)
downloadgit-1d2c14df1605a05118524b2382402d689f69d737.zip
git-1d2c14df1605a05118524b2382402d689f69d737.tar.gz
git-1d2c14df1605a05118524b2382402d689f69d737.tar.bz2
push: fix segfault when HEAD points nowhere
After a push of a branch other than the current branch fails in a no-ff error and if you are still on an unborn branch, the code recently added to report the failure dereferenced a null pointer while checking the name of the current branch. Signed-off-by: Fraser Tweedale <frase@frase.id.au> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/transport.c b/transport.c
index 7864007..af442af 100644
--- a/transport.c
+++ b/transport.c
@@ -744,7 +744,7 @@ void transport_print_push_status(const char *dest, struct ref *refs,
n += print_one_push_status(ref, dest, n, porcelain);
if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD &&
*nonfastforward != NON_FF_HEAD) {
- if (!strcmp(head, ref->name))
+ if (head != NULL && !strcmp(head, ref->name))
*nonfastforward = NON_FF_HEAD;
else
*nonfastforward = NON_FF_OTHER;