From 897d4f1d8451bb495e395fe3b1b2c9d4a8dc8fc5 Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Wed, 24 Aug 2016 02:05:55 +1200 Subject: [PATCH] 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 --- tools/ccan_depends.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; } -- 2.39.2