diff options
-rw-r--r-- | builtin/remote.c | 2 | ||||
-rw-r--r-- | log-tree.c | 2 | ||||
-rw-r--r-- | t/helper/test-ref-store.c | 2 | ||||
-rw-r--r-- | worktree.c | 3 |
4 files changed, 5 insertions, 4 deletions
diff --git a/builtin/remote.c b/builtin/remote.c index 4f5cac96b0..bc89623695 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -565,7 +565,7 @@ static int read_remote_branches(const char *refname, item = string_list_append(rename->remote_branches, xstrdup(refname)); symref = resolve_ref_unsafe(refname, RESOLVE_REF_READING, NULL, &flag); - if (flag & REF_ISSYMREF) + if (symref && (flag & REF_ISSYMREF)) item->util = xstrdup(symref); else item->util = NULL; diff --git a/log-tree.c b/log-tree.c index cea056234d..580b3a98a0 100644 --- a/log-tree.c +++ b/log-tree.c @@ -198,7 +198,7 @@ static const struct name_decoration *current_pointed_by_HEAD(const struct name_d /* Now resolve and find the matching current branch */ branch_name = resolve_ref_unsafe("HEAD", 0, NULL, &rru_flags); - if (!(rru_flags & REF_ISSYMREF)) + if (!branch_name || !(rru_flags & REF_ISSYMREF)) return NULL; if (!starts_with(branch_name, "refs/")) diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index 05d8c4d8af..6ec2670044 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -135,7 +135,7 @@ static int cmd_resolve_ref(struct ref_store *refs, const char **argv) ref = refs_resolve_ref_unsafe(refs, refname, resolve_flags, sha1, &flags); - printf("%s %s 0x%x\n", sha1_to_hex(sha1), ref, flags); + printf("%s %s 0x%x\n", sha1_to_hex(sha1), ref ? ref : "(null)", flags); return ref ? 0 : 1; } diff --git a/worktree.c b/worktree.c index 70015629dc..f8c40f2f5f 100644 --- a/worktree.c +++ b/worktree.c @@ -327,7 +327,8 @@ const struct worktree *find_shared_symref(const char *symref, refs = get_worktree_ref_store(wt); symref_target = refs_resolve_ref_unsafe(refs, symref, 0, NULL, &flags); - if ((flags & REF_ISSYMREF) && !strcmp(symref_target, target)) { + if ((flags & REF_ISSYMREF) && + symref_target && !strcmp(symref_target, target)) { existing = wt; break; } |