When logging XML error messages, make sure we don't accidentally log an empty message

Amends my previous commit #a7508a9c from 23rd July 2015. If the filename and/or line number were NULL, we could end up logging a message with no text!
This commit is contained in:
John Emmas 2016-04-21 16:45:15 +01:00
parent 238cec8549
commit fba9dc8c05
1 changed files with 10 additions and 5 deletions

View File

@ -226,14 +226,19 @@ libxml_structured_error_func (void* /* parsing_context*/,
replace_all (msg, "\n", "");
if (err->file && err->line) {
error << X_("XML error: ") << msg << " in " << err->file << " at line " << err->line;
if (!msg.empty()) {
if (err->file && err->line) {
error << X_("XML error: ") << msg << " in " << err->file << " at line " << err->line;
if (err->int2) {
error << ':' << err->int2;
if (err->int2) {
error << ':' << err->int2;
}
error << endmsg;
} else {
error << msg << endmsg;
}
}
error << endmsg;
}