submodule-config: fix test binary crashing when no arguments given
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> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Heiko Voigt committed
Jul 28, 2016 at 14:50 UTC
55cbe18e1146320674968820150126ee34e5d332
1 file changed
+1
-1
test-submodule-config.c
+1
-1
@@ -23,7 +23,7 @@ int main(int argc, char **argv)
23
24
arg++;
25
my_argc--;
26
- while (starts_with(arg[0], "--")) {
26
+ while (arg[0] && starts_with(arg[0], "--")) {
27
if (!strcmp(arg[0], "--url"))
28
output_url = 1;
29
if (!strcmp(arg[0], "--name"))