Browse Source

tools/ccan_depends: Don't crash when no dependencies are found

Running 'tools/ccan_depends --compile ccan/crypto' without this
patch will demonstrate the crash.

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
Jon Griffiths 9 years ago
parent
commit
897d4f1d84
1 changed files with 4 additions and 3 deletions
  1. 4 3
      tools/ccan_depends.c

+ 4 - 3
tools/ccan_depends.c

@@ -46,8 +46,9 @@ int main(int argc, char *argv[])
 	else
 	else
 		deps = get_safe_ccan_deps(NULL, argv[1], style, recurse);
 		deps = get_safe_ccan_deps(NULL, argv[1], style, recurse);
 
 
-	for (i = 0; deps[i]; i++)
-		if (strstarts(deps[i], "ccan/") == ccan)
-			printf("%s\n", deps[i]);
+	if (deps)
+		for (i = 0; deps[i]; i++)
+			if (strstarts(deps[i], "ccan/") == ccan)
+				printf("%s\n", deps[i]);
 	return 0;
 	return 0;
 }
 }