Skip to content

Commit d1df00a

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 <johannes.schindelin@gmx.de>
1 parent 16bd9f2 commit d1df00a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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)