Skip to content

Commit 7728473

Browse files
committed
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
2 parents d2216a4 + 1d2c14d commit 7728473

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ void transport_print_push_status(const char *dest, struct ref *refs,
741741
n += print_one_push_status(ref, dest, n, porcelain);
742742
if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD &&
743743
*nonfastforward != NON_FF_HEAD) {
744-
if (!strcmp(head, ref->name))
744+
if (head != NULL && !strcmp(head, ref->name))
745745
*nonfastforward = NON_FF_HEAD;
746746
else
747747
*nonfastforward = NON_FF_OTHER;

0 commit comments

Comments
 (0)