summaryrefslogtreecommitdiffstats
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-02-08 00:15:08 +0100
committerJunio C Hamano <gitster@pobox.com>2013-02-08 00:15:08 +0100
commit772847341bc6ea73c57f350ae25688eae95c5c23 (patch)
tree78b1ff551578fa5e0495ac3cf298a6e1a301e7f5 /transport.c
parentMerge branch 'sb/gpg-plug-fd-leak' into maint (diff)
parentpush: fix segfault when HEAD points nowhere (diff)
downloadgit-772847341bc6ea73c57f350ae25688eae95c5c23.tar.xz
git-772847341bc6ea73c57f350ae25688eae95c5c23.zip
Merge branch 'ft/transport-report-segv' into maint
A failure to push due to non-ff while on an unborn branch dereferenced a NULL pointer when showing an error message. * ft/transport-report-segv: push: fix segfault when HEAD points nowhere
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 9932f402df..b9306ef645 100644
--- a/transport.c
+++ b/transport.c
@@ -741,7 +741,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;