Fixed: [CLI crash if error-info is empty #134](https://github.com/clicon/clixon/issues/134)

This commit is contained in:
Olof hagsand 2020-09-01 16:19:58 +02:00
parent 41ac192362
commit a01fe04613
2 changed files with 3 additions and 1 deletions

View file

@ -1396,7 +1396,8 @@ netconf_err2cb(cxobj *xerr,
cprintf(cberr, "%s ", xml_body(x));
if ((x=xpath_first(xerr, NULL, "//error-message"))!=NULL)
cprintf(cberr, "%s ", xml_body(x));
if ((x=xpath_first(xerr, NULL, "//error-info"))!=NULL)
if ((x=xpath_first(xerr, NULL, "//error-info"))!=NULL &&
xml_child_nr(x) > 0)
clicon_xml2cbuf(cberr, xml_child_i(x,0), 0, 0, -1);
if ((x=xpath_first(xerr, NULL, "//error-app-tag"))!=NULL)
cprintf(cberr, ": %s ", xml_body(x));