From a7508a9cf007f52c40b2f86cd17f9b221b3e45e3 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Thu, 23 Jul 2015 17:52:42 +0100 Subject: [PATCH] When printing an XML related error, guard against NULL pointers getting passed to our error stream --- gtk2_ardour/ardour_ui.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index b99d5e337f..b9bb084322 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -203,13 +203,19 @@ static void libxml_structured_error_func (void* /* parsing_context*/, xmlErrorPtr err) { - string msg = err->message; + string msg; + + if (err->message) + msg = err->message; replace_all (msg, "\n", ""); - error << X_("XML error: ") << msg << " in " << err->file << " at line " << err->line; - if (err->int2) { - error << ':' << err->int2; + if (err->file && err->line) { + error << X_("XML error: ") << msg << " in " << err->file << " at line " << err->line; + + if (err->int2) { + error << ':' << err->int2; + } } error << endmsg; }