Skip to content

Commit 0ea9dcd

Browse files
committed
revision: defensive programming
On the off chance that `lookup_decoration()` cannot find anything, let `leave_one_treesame_to_parent()` return gracefully instead of crashing. Pointed out by CodeQL. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 76d27a6 commit 0ea9dcd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

revision.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,6 +3336,9 @@ static int leave_one_treesame_to_parent(struct rev_info *revs, struct commit *co
33363336
struct commit_list *p;
33373337
unsigned n;
33383338

3339+
if (!ts)
3340+
return 0;
3341+
33393342
for (p = commit->parents, n = 0; p; p = p->next, n++) {
33403343
if (ts->treesame[n]) {
33413344
if (p->item->object.flags & TMP_MARK) {

0 commit comments

Comments
 (0)