From 1d2c14df1605a05118524b2382402d689f69d737 Mon Sep 17 00:00:00 2001 From: Fraser Tweedale Date: Thu, 31 Jan 2013 22:22:51 +1000 Subject: 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 Signed-off-by: Junio C Hamano --- transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transport.c b/transport.c index 7864007c9c..af442af329 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; -- cgit v1.2.3