check return code of prepare_revision_walk
[gitweb.git] / shallow.c
index d17868929ceadbd2565549a60cb738a95c90a4bb..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;
                                }
@@ -101,4 +101,3 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
 
        return result;
 }
-