[PATCH 12/14] submodule: check return value of `submodule_from_path()`
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- May 15, 2025, 12:45 UTC
- Message-ID
- <223a0053eb7f94dfd28db8f528b73a489f907444.1747313140.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1890.git.1747313139.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
As pointed out by CodeQL, it could be NULL and we usually check for that.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- builtin/submodule--helper.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c1a8029714bf..55826b82407c 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1934,6 +1934,9 @@ static int determine_submodule_update_strategy(struct repository *r, const char *val; int ret; + if (!sub) + return error(_("could not retrieve submodule information for path '%s'"), path); + key = xstrfmt("submodule.%s.update", sub->name); if (update) {
-- gitgitgadget