浏览代码

Adds some pointer cleanup in the event we bail out of creating a new object for whatever reason.

Areloch 9 年之前
父节点
当前提交
3cfc6f787c
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Engine/source/console/compiledEval.cpp

+ 2 - 0
Engine/source/console/compiledEval.cpp

@@ -902,6 +902,7 @@ breakContinue:
 
 
                      // Fail to create the object.
                      // Fail to create the object.
                      delete object;
                      delete object;
+                     currentNewObject = NULL;
                      ip = failJump;
                      ip = failJump;
                      break;
                      break;
                   }
                   }
@@ -1016,6 +1017,7 @@ breakContinue:
                Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", getFileLine(ip),
                Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", getFileLine(ip),
                            currentNewObject->getName(), errorStr.c_str());
                            currentNewObject->getName(), errorStr.c_str());
                dataBlock->deleteObject();
                dataBlock->deleteObject();
+               currentNewObject = NULL;
                ip = failJump;
                ip = failJump;
 			   
 			   
                // Prevent stack value corruption
                // Prevent stack value corruption