check null ptr

This commit is contained in:
Olof Hagsand 2018-06-07 21:10:01 +02:00
parent c5991c9844
commit de69b253dc

View file

@ -205,7 +205,7 @@ yang2cli_var_sub(clicon_handle h,
} }
type = ytype?ytype->ys_argument:NULL; type = ytype?ytype->ys_argument:NULL;
cvtypestr = cv_type2str(cvtype); cvtypestr = cv_type2str(cvtype);
if (strcmp(type, "identityref") == 0) if (type && strcmp(type, "identityref") == 0)
cprintf(cb, "("); cprintf(cb, "(");
cprintf(cb, "<%s:%s", ys->ys_argument, cvtypestr); cprintf(cb, "<%s:%s", ys->ys_argument, cvtypestr);
/* enumeration special case completion */ /* enumeration special case completion */
@ -292,7 +292,7 @@ yang2cli_var_sub(clicon_handle h,
cprintf(cb, ">"); cprintf(cb, ">");
if (helptext) if (helptext)
cprintf(cb, "(\"%s\")", helptext); cprintf(cb, "(\"%s\")", helptext);
if (strcmp(type, "identityref") == 0) if (type && strcmp(type, "identityref") == 0)
cprintf(cb, ")"); cprintf(cb, ")");
retval = 0; retval = 0;