From 25490528af58591874d177034c2ec0000eb6aab0 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 11 Mar 2025 10:54:34 +0100 Subject: [PATCH] parser: Fix spurious error in SAX mode Short-lived regression from 5f0b1378. --- parser.c | 2 -- parserInternals.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parser.c b/parser.c index 283539ac..42684e02 100644 --- a/parser.c +++ b/parser.c @@ -13817,8 +13817,6 @@ xmlCtxtParseDocument(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) xmlParseDocument(ctxt); ret = xmlCtxtGetDocument(ctxt); - if ((ret == NULL) && (ctxt->errNo == XML_ERR_OK)) - xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, "unknown error\n"); /* assert(ctxt->inputNr == 1); */ while (ctxt->inputNr > 0) diff --git a/parserInternals.c b/parserInternals.c index 5c80694c..e24af956 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -3230,6 +3230,8 @@ xmlCtxtGetDocument(xmlParserCtxtPtr ctxt) { (!xmlCtxtIsCatastrophicError(ctxt)))) { doc = ctxt->myDoc; } else { + if (ctxt->errNo == XML_ERR_OK) + xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "unknown error"); doc = NULL; xmlFreeDoc(ctxt->myDoc); }