Skip to content

Commit 150d31a

Browse files
dschogitster
authored andcommitted
stash: defensive programming
CodeQL points out that `parse_tree_indirect()` can return NULL values. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 27c5fa3 commit 150d31a

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
@@ -284,7 +284,7 @@ static int reset_tree(struct object_id *i_tree, int update, int reset)
284284
memset(&opts, 0, sizeof(opts));
285285

286286
tree = parse_tree_indirect(i_tree);
287-
if (parse_tree(tree))
287+
if (!tree || parse_tree(tree))
288288
return -1;
289289

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

0 commit comments

Comments
 (0)