]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix a NULL dereference in the case that the arg in question
authorChris Lalancette <clalance@redhat.com>
Tue, 20 Jul 2010 16:51:12 +0000 (12:51 -0400)
committerChris Lalancette <clalance@redhat.com>
Tue, 20 Jul 2010 16:51:12 +0000 (12:51 -0400)
didn't exist.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
tools/virsh.c

index 17c3074403100440be260bfd0d810a5a29e9696d..354feb0c29fd1a17dcd40221161c87bf653d897e 100644 (file)
@@ -9771,7 +9771,7 @@ vshCommandOptString(const vshCmd *cmd, const char *name, int *found)
     if (arg && arg->data && *arg->data)
         return arg->data;
 
-    if ((arg->def->flag) & VSH_OFLAG_REQ)
+    if (arg && arg->def && ((arg->def->flag) & VSH_OFLAG_REQ))
         vshError(NULL, _("Missing required option '%s'"), name);
 
     return NULL;