Skip to content

Commit 1bcf5e9

Browse files
dschogitster
authored andcommitted
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]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a8a497 commit 1bcf5e9

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
@@ -3353,6 +3353,9 @@ static int leave_one_treesame_to_parent(struct rev_info *revs, struct commit *co
33533353
struct commit_list *p;
33543354
unsigned n;
33553355

3356+
if (!ts)
3357+
return 0;
3358+
33563359
for (p = commit->parents, n = 0; p; p = p->next, n++) {
33573360
if (ts->treesame[n]) {
33583361
if (p->item->object.flags & TMP_MARK) {

0 commit comments

Comments
 (0)