packfile: refactor hash search with fanout table
[gitweb.git] / worktree.c
index 70015629dc69e4bdf7f8ef1973596f3360898da3..f8c40f2f5f8ce5b18c976b5281f5618adbeee4a7 100644 (file)
@@ -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;
                }