Fix 0 ptr reference for OPAC records from XML YAZ-822
[yaz-moved-to-github.git] / src / xml_match.c
index 9e14c49..7dddb6f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
  * See the file LICENSE for details.
  */
 /**
@@ -16,7 +16,8 @@
 
 int yaz_match_xsd_element(xmlNodePtr ptr, const char *elem)
 {
-    if (ptr->type == XML_ELEMENT_NODE && !xmlStrcmp(ptr->name, BAD_CAST elem))
+    if (ptr && ptr->type == XML_ELEMENT_NODE &&
+        !xmlStrcmp(ptr->name, BAD_CAST elem))
     {
         return 1;
     }