Validate parser parameter to XML_SetReturnNSTriplet
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
index e0e39de..84f18ae 100644
--- a/expat/lib/xmlparse.c
+++ b/expat/lib/xmlparse.c
@@ -1308,6 +1308,8 @@
 void XMLCALL
 XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
 {
+  if (parser == NULL)
+    return;
   /* block after XML_Parse()/XML_ParseBuffer() has been called */
   if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
     return;