Fix a NULL dereference in the case that the arg in question

didn't exist.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
Chris Lalancette 2010-07-20 12:51:12 -04:00
parent 4d13418890
commit cd35e8927f

View 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;