Merge pull request #1190 from ssinger/fix_segfault

Avoid dereferencing a null error structure
This commit is contained in:
Dane Springmeyer 2012-04-23 19:19:42 -07:00
commit 2f8d08c366

View file

@ -135,11 +135,15 @@ public:
xmlError * error = xmlCtxtGetLastError( ctx_ ); xmlError * error = xmlCtxtGetLastError( ctx_ );
std::ostringstream os; std::ostringstream os;
os << "XML document not well formed"; os << "XML document not well formed";
int line=0;
std::string file;
if (error) if (error)
{ {
os << ": " << std::endl << error->message; os << ": " << std::endl << error->message;
line = error->line;
file = error->file;
} }
throw config_error(os.str(), error->line, error->file); throw config_error(os.str(), line, file);
} }
int iXIncludeReturn = xmlXIncludeProcessFlags(doc, options_); int iXIncludeReturn = xmlXIncludeProcessFlags(doc, options_);