summaryrefslogtreecommitdiff
path: root/src/commit_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/commit_list.c')
-rw-r--r--src/commit_list.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/commit_list.c b/src/commit_list.c
index c1a7b223f..734e1051f 100644
--- a/src/commit_list.c
+++ b/src/commit_list.c
@@ -127,7 +127,7 @@ static int commit_quick_parse(git_revwalk *walk, git_commit_list_node *commit, g
if (git_oid_fromstr(&oid, (char *)buffer + strlen("parent ")) < 0)
return -1;
- commit->parents[i] = commit_lookup(walk, &oid);
+ commit->parents[i] = git_revwalk__commit_lookup(walk, &oid);
if (commit->parents[i] == NULL)
return -1;
@@ -181,9 +181,13 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
if ((error = git_odb_read(&obj, walk->odb, &commit->oid)) < 0)
return error;
- assert(obj->raw.type == GIT_OBJ_COMMIT);
- error = commit_quick_parse(walk, commit, &obj->raw);
+ if (obj->raw.type == GIT_OBJ_COMMIT) {
+ giterr_set(GITERR_INVALID, "Object is no commit object");
+ error = -1;
+ } else
+ error = commit_quick_parse(walk, commit, &obj->raw);
+
git_odb_object_free(obj);
return error;
}