Skip to content

Commit

Permalink
Merge branch 'ft/transport-report-segv'
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 6, 2013
2 parents f51a757 + 1d2c14d commit 8278a7b
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 @@ -752,7 +752,7 @@ void transport_print_push_status(const char *dest, struct ref *refs,
ref->status != REF_STATUS_OK)
n += print_one_push_status(ref, dest, n, porcelain);
if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD) {
if (!strcmp(head, ref->name))
if (head != NULL && !strcmp(head, ref->name))
*reject_reasons |= REJECT_NON_FF_HEAD;
else
*reject_reasons |= REJECT_NON_FF_OTHER;
Expand Down

0 comments on commit 8278a7b

Please sign in to comment.