From: Johannes Schindelin via GitGitGadget Date: Thu, 15 May 2025 12:45:31 GMT Subject: [PATCH 06/14] stash: defensive programming Message-ID: <130251bc324cc90ab19f82552888071f974c35b6.1747313140.git.gitgitgadget@gmail.com> In-Reply-To: From: Johannes Schindelin CodeQL points out that `parse_tree_indirect()` can return NULL values. Signed-off-by: Johannes Schindelin --- builtin/stash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/stash.c b/builtin/stash.c index dbaa999cf171..23c4bbd3e21e 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -285,7 +285,7 @@ static int reset_tree(struct object_id *i_tree, int update, int reset) memset(&opts, 0, sizeof(opts)); tree = parse_tree_indirect(i_tree); - if (parse_tree(tree)) + if (!tree || parse_tree(tree)) return -1; init_tree_desc(t, &tree->object.oid, tree->buffer, tree->size); -- gitgitgadget