help: make help_unknown_ref() NORETURN
[gitweb.git] / sha1-name.c
index b4f5cadae745e54d03729f135a2208a3067ad0fa..728e6f1f61ea4641272e59e6287b6b47bfe0c74e 100644 (file)
@@ -1843,7 +1843,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
                if (flags & GET_OID_RECORD_PATH)
                        oc->path = xstrdup(cp);
 
-               if (!repo->index->cache)
+               if (!repo->index || !repo->index->cache)
                        repo_read_index(repo);
                pos = index_name_pos(repo->index, cp, namelen);
                if (pos < 0)