From: Jon Griffiths Date: Tue, 23 Aug 2016 14:05:55 +0000 (+1200) Subject: tools/ccan_depends: Don't crash when no dependencies are found X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=897d4f1d8451bb495e395fe3b1b2c9d4a8dc8fc5 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 --- diff --git a/tools/ccan_depends.c b/tools/ccan_depends.c index a487e09b..f81a42b8 100644 --- a/tools/ccan_depends.c +++ b/tools/ccan_depends.c @@ -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; }