浏览代码

Protection against attemp to delete a non-existing node in the XML...

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3038 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 11 年之前
父节点
当前提交
940be2504a
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      setup/modelfactory.class.inc.php

+ 4 - 0
setup/modelfactory.class.inc.php

@@ -343,6 +343,10 @@ class ModelFactory
 
 		case 'delete':
 			$oTargetNode = $oTargetParentNode->FindExistingChildNode($oSourceNode);
+			if($oTargetNode == null)
+			{
+				throw new Exception("Trying to delete node for {$oSourceNode->tagName} (id:".$oSourceNode->getAttribute('id').") under {$oTargetParentNode->tagName} (id:".$oTargetParentNode->getAttribute('id').'). but nothing found.');
+			}
 			$oTargetNode->Delete();
 			break;
 		}