summaryrefslogtreecommitdiff
path: root/builtin-fetch.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-fetch.c')
-rw-r--r--builtin-fetch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 300d5635b0..d9272edae9 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -151,7 +151,8 @@ static int update_local_ref(struct ref *ref,
return 0;
}
- if (!strcmp(ref->name, current_branch->name) &&
+ if (current_branch &&
+ !strcmp(ref->name, current_branch->name) &&
!(update_head_ok || is_bare_repository()) &&
!is_null_sha1(ref->old_sha1)) {
/*