diff --git a/expat/lib/expat.h b/expat/lib/expat.h index 479b6784..ff83ff11 100644 --- a/expat/lib/expat.h +++ b/expat/lib/expat.h @@ -943,7 +943,8 @@ XML_GetErrorCode(XML_Parser parser); was detected; otherwise the location is the location of the last parse event, as described above. - Note: XML_GetCurrentLineNumber returns 0 to indicate an error + Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber + return 0 to indicate an error. Note: XML_GetCurrentByteIndex returns -1 to indicate an error. */ XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index ae9eb1ce..9b2b6fa6 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -2071,6 +2071,8 @@ XML_GetCurrentLineNumber(XML_Parser parser) XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr;