From: Heiko Voigt <hvoigt@hvoigt.net>
Date: Thu, 28 Jul 2016 12:50:05 +0000 (+0200)
Subject: submodule-config: fix test binary crashing when no arguments given
X-Git-Tag: v2.9.3~26^2
X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/55cbe18e1146320674968820150126ee34e5d332

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>
---

diff --git a/test-submodule-config.c b/test-submodule-config.c
index dab8c27768..a4e4098a0f 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"))