diff options
Diffstat (limited to 'cli/src/cli-xml-output.c')
| -rw-r--r-- | cli/src/cli-xml-output.c | 18 | 
1 files changed, 12 insertions, 6 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index ffe32cacc..e43932662 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -149,13 +149,19 @@ cli_xml_output_str (char *op, char *str, int op_ret, int op_errno,          if (ret)                  goto out; -        ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"cliOp", -                                               "%s", op); -        XML_RET_CHECK_AND_GOTO (ret, out); +        if (op) { +                ret = xmlTextWriterWriteFormatElement (writer, +                                                       (xmlChar *)"cliOp", +                                                       "%s", op); +                XML_RET_CHECK_AND_GOTO (ret, out); +        } -        ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"output", -                                               "%s", str); -        XML_RET_CHECK_AND_GOTO (ret, out); +        if (str) { +                ret = xmlTextWriterWriteFormatElement (writer, +                                                       (xmlChar *)"output", +                                                       "%s", str); +                XML_RET_CHECK_AND_GOTO (ret, out); +        }          ret = cli_end_xml_output (writer, buf);  | 
