]> git.ozlabs.org Git - ccan/commitdiff
tools/ccan_depends: Don't crash when no dependencies are found
authorJon Griffiths <jon_p_griffiths@yahoo.com>
Tue, 23 Aug 2016 14:05:55 +0000 (02:05 +1200)
committerJon Griffiths <jon_p_griffiths@yahoo.com>
Wed, 24 Aug 2016 06:52:29 +0000 (18:52 +1200)
Running 'tools/ccan_depends --compile ccan/crypto' without this
patch will demonstrate the crash.

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
tools/ccan_depends.c

index a487e09be712588122142c6d9274ff4b9397e4bd..f81a42b861fae905c4cbba2c1816b6cde4bb23ba 100644 (file)
@@ -46,8 +46,9 @@ int main(int argc, char *argv[])
        else
                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;
 }