From a51a747018c0dfad11f8256e01c967ec0a49151f Mon Sep 17 00:00:00 2001
From: Alberto Massari <amassari@apache.org>
Date: Thu, 7 Apr 2005 15:08:57 +0000
Subject: [PATCH] appendChild now throws an exception when a NULL pointer is
 given (jira# 1401)

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@176377 13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/dom/impl/DOMParentNode.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/xercesc/dom/impl/DOMParentNode.cpp b/src/xercesc/dom/impl/DOMParentNode.cpp
index e5fd5a060..3d1a976e6 100644
--- a/src/xercesc/dom/impl/DOMParentNode.cpp
+++ b/src/xercesc/dom/impl/DOMParentNode.cpp
@@ -139,6 +139,10 @@ bool DOMParentNode::hasChildNodes() const
 
 
 DOMNode *DOMParentNode::insertBefore(DOMNode *newChild, DOMNode *refChild) {
+    //not really in the specs, but better than nothing
+    if(newChild==NULL)
+        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager);
+
     DOMNodeImpl *thisNodeImpl = castToNodeImpl(this);
     if (thisNodeImpl->isReadOnly())
         throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMParentNodeMemoryManager);
-- 
GitLab