From 890faa546bf386816dea59d0f1075bc3a42de263 Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Mon, 27 Aug 2012 13:24:08 +0800 Subject: [PATCH] Fix problem with specific and generic error handlers It seems that setting up both xmlTextReaderSetStructuredErrorHandler and xmlSetStructuredErrorFunc confuses the code around error.c:592 and following This patch works with any combinations of using xmlSetStructuredErrorFunc, xmlTextReaderSetStructuredErrorHandler, both, or none. --- error.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/error.c b/error.c index 1c2fb36e..6b7ef591 100644 --- a/error.c +++ b/error.c @@ -615,8 +615,11 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, data = ctxt->userData; } else if (channel == NULL) { channel = xmlGenericError; - if (!data) + if (ctxt != NULL) { + data = ctxt; + } else { data = xmlGenericErrorContext; + } } if (channel == NULL) return;