Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 5543501

Browse files
committed
Merge branch 'nh/empty-rebase'
By Neil Horman * nh/empty-rebase: git cherry-pick: do not dereference a potential NULL pointer
2 parents fc1320b + 4b58006 commit 5543501

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sequencer.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,17 @@ static int is_index_unchanged(void)
261261
return error(_("Could not resolve HEAD commit\n"));
262262

263263
head_commit = lookup_commit(head_sha1);
264-
if (!head_commit || parse_commit(head_commit))
265-
return error(_("could not parse commit %s\n"),
266-
sha1_to_hex(head_commit->object.sha1));
264+
265+
/*
266+
* If head_commit is NULL, check_commit, called from
267+
* lookup_commit, would have indicated that head_commit is not
268+
* a commit object already. parse_commit() will return failure
269+
* without further complaints in such a case. Otherwise, if
270+
* the commit is invalid, parse_commit() will complain. So
271+
* there is nothing for us to say here. Just return failure.
272+
*/
273+
if (parse_commit(head_commit))
274+
return -1;
267275

268276
if (!active_cache_tree)
269277
active_cache_tree = cache_tree();

0 commit comments

Comments
 (0)