[PATCH 3/3] submodule-config: fix test binary crashing when no arguments given
- From
Heiko Voigt <hvoigt@hvoigt.net>
- Date
- Jul 28, 2016, 12:50 UTC
- Message-ID
- <20160728125002.GC2530@sandbox>
- In-Reply-To
- <xmqqmvl4xdlm.fsf@gitster.mtv.corp.google.com>
Since arg[0] will be NULL without any argument here and starts_with() does not like NULL-pointers.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> --- A small fix I found while developing the test.
test-submodule-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test-submodule-config.c b/test-submodule-config.c index dab8c27..a4e4098 100644 --- a/test-submodule-config.c +++ b/test-submodule-config.c @@ -23,7 +23,7 @@ int main(int argc, char **argv) arg++; my_argc--; - while (starts_with(arg[0], "--")) { + while (arg[0] && starts_with(arg[0], "--")) { if (!strcmp(arg[0], "--url")) output_url = 1; if (!strcmp(arg[0], "--name"))
-- 2.0.2.832.g083c931