Browse Source

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 years ago
parent
commit
940be2504a
1 changed files with 4 additions and 0 deletions
  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;
 		}