]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: be more paranoid about possibly NULL description
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 22 Jul 2020 16:32:54 +0000 (17:32 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 23 Jul 2020 13:58:24 +0000 (14:58 +0100)
GCC 10 complains about "desc" possibly being a NULL dereference. Even
though it is a false positive, we can easily avoid it.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tools/vsh.c

index 527c1354241912bc7f608ddef0b13778bfeb142c..b65e99cbd20a2cc77353a5d269e0f9c5070ff6b3 100644 (file)
@@ -689,7 +689,7 @@ vshCmddefHelp(vshControl *ctl, const vshCmdDef *def)
     fputc('\n', stdout);
 
     desc = vshCmddefGetInfo(def, "desc");
-    if (*desc) {
+    if (desc && *desc) {
         /* Print the description only if it's not empty.  */
         fputs(_("\n  DESCRIPTION\n"), stdout);
         fprintf(stdout, "    %s\n", _(desc));