]> git.ipfire.org Git - thirdparty/git.git/blobdiff - shallow.c
deref_tag: handle return value NULL
[thirdparty/git.git] / shallow.c
index dbd9f5ad0ac21e70fc3a095d8e2938f245c238d3..212e62b77ceea1f81c1938f012099e828f45aa85 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -56,7 +56,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
                        if (i < heads->nr) {
                                commit = (struct commit *)
                                        deref_tag(heads->objects[i++].item, NULL, 0);
-                               if (commit->object.type != OBJ_COMMIT) {
+                               if (!commit || commit->object.type != OBJ_COMMIT) {
                                        commit = NULL;
                                        continue;
                                }