Commit 8f9804ed authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Add a helper to check for error handler being set.

parent 843bd250
...@@ -132,6 +132,12 @@ static inline BOOL has_content_handler(const saxlocator *locator) ...@@ -132,6 +132,12 @@ static inline BOOL has_content_handler(const saxlocator *locator)
(!locator->vbInterface && locator->saxreader->contentHandler); (!locator->vbInterface && locator->saxreader->contentHandler);
} }
static inline BOOL has_error_handler(const saxlocator *locator)
{
return (locator->vbInterface && locator->saxreader->vberrorHandler) ||
(!locator->vbInterface && locator->saxreader->errorHandler);
}
static HRESULT namespacePush(saxlocator *locator, int ns) static HRESULT namespacePush(saxlocator *locator, int ns)
{ {
if(locator->nsStackLast>=locator->nsStackSize) if(locator->nsStackLast>=locator->nsStackSize)
...@@ -202,8 +208,7 @@ static void format_error_message_from_id(saxlocator *This, HRESULT hr) ...@@ -202,8 +208,7 @@ static void format_error_message_from_id(saxlocator *This, HRESULT hr)
xmlStopParser(This->pParserCtxt); xmlStopParser(This->pParserCtxt);
This->ret = hr; This->ret = hr;
if((This->vbInterface && This->saxreader->vberrorHandler) if(has_error_handler(This))
|| (!This->vbInterface && This->saxreader->errorHandler))
{ {
WCHAR msg[1024]; WCHAR msg[1024];
if(!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, if(!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM,
...@@ -1299,8 +1304,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...) ...@@ -1299,8 +1304,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
DWORD len; DWORD len;
va_list args; va_list args;
if((This->vbInterface && !This->saxreader->vberrorHandler) if(!has_error_handler(This))
|| (!This->vbInterface && !This->saxreader->errorHandler))
{ {
xmlStopParser(This->pParserCtxt); xmlStopParser(This->pParserCtxt);
This->ret = E_FAIL; This->ret = E_FAIL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment