X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5dac8a3b0edfc2ec0c4f3ab1e470e439baf426d8..27ce9aef53de32179153fbfbbdd9d52720d165e8:/contrib/src/xrc/xml.cpp diff --git a/contrib/src/xrc/xml.cpp b/contrib/src/xrc/xml.cpp index dac3341329..b8b8aabec8 100644 --- a/contrib/src/xrc/xml.cpp +++ b/contrib/src/xrc/xml.cpp @@ -531,6 +531,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding) XML_SetDefaultHandler(parser, DefaultHnd); XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL); + bool ok = true; do { size_t len = stream.Read(buf, BUFSIZE).LastRead(); @@ -540,13 +541,17 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding) wxLogError(_("XML parsing error: '%s' at line %d"), XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); - return FALSE; + ok = false; + break; } } while (!done); - SetVersion(ctx.version); - SetFileEncoding(ctx.encoding); - SetRoot(ctx.root); + if (ok) + { + SetVersion(ctx.version); + SetFileEncoding(ctx.encoding); + SetRoot(ctx.root); + } XML_ParserFree(parser); #if !wxUSE_UNICODE @@ -554,7 +559,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding) delete ctx.conv; #endif - return TRUE; + return ok; }