static-delta: Fix probably not actually possible NULL deref
authorColin Walters <walters@verbum.org>
Fri, 8 Oct 2021 13:07:41 +0000 (09:07 -0400)
committerColin Walters <walters@verbum.org>
Wed, 13 Oct 2021 21:13:14 +0000 (17:13 -0400)
Flagged by `gcc -fanalyzer`.  I didn't study this really deeply
but I think it's not actually reachable.  Anyways, let's catch
it on general principle.

src/ostree/ot-builtin-static-delta.c

index ff31b574e8478285f98e3b426516118dee7ca8df..0ce3cefbfe178b7b654a4d4def351fecc1a154ef 100644 (file)
@@ -669,7 +669,7 @@ ostree_builtin_static_delta (int argc, char **argv, OstreeCommandInvocation *inv
       return TRUE; /* Note early return */
     }
 
-  if (!command->fn)
+  if (!command || !command->fn)
     {
       static_delta_usage (argv, TRUE);
       return glnx_throw (error, "Unknown \"static-delta\" subcommand '%s'", cmdname);