Skip to content

Commit

Permalink
Merge branch 'ft/transport-report-segv' into maint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Feb 7, 2013
2 parents d2216a4 + 1d2c14d commit 7728473
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7728473

Please sign in to comment.