]> git.ozlabs.org Git - next-scripts/commitdiff
fetch_trees: explicitly check that a tree exists
authorStephen Rothwell <sfr@canb.auug.org.au>
Sat, 29 Sep 2018 02:09:18 +0000 (12:09 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sat, 29 Sep 2018 02:09:18 +0000 (12:09 +1000)
fetch_trees

index 87e1b6cca2ab0af600b4f83b07af0f4dece748a8..2747e92df23817b2e464a9691481c327b3ee3b09 100755 (executable)
@@ -108,9 +108,13 @@ for name in $trees; do
        }
 
        type=$(get_field "$name" 2)
+       if ! [ "$type" ]; then
+               printf "%s: unknown tree\n" "$name" 1>&2
+               continue
+       fi
 
        echo $name: $type
-       [ $(type -t "fetch_$type") = "function" ] &&
+       [ "$(type -t fetch_$type)" = "function" ] &&
                fetch_$type "$name"
 done