Skip to content

Commit 7835772

Browse files
committed
stash: defensive programming
CodeQL points out that `parse_tree_indirect()` can return NULL values. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 0691fe8 commit 7835772

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/stash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static int reset_tree(struct object_id *i_tree, int update, int reset)
348348
memset(&opts, 0, sizeof(opts));
349349

350350
tree = parse_tree_indirect(i_tree);
351-
if (parse_tree(tree))
351+
if (!tree || parse_tree(tree))
352352
return -1;
353353

354354
init_tree_desc(t, &tree->object.oid, tree->buffer, tree->size);

0 commit comments

Comments
 (0)