From 6d93e96dc3dbd31458cf90db0f35a5dea82e08bd Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Tue, 7 Sep 2021 21:03:57 -0400 Subject: [PATCH] NULL out an object variable if it fails to register. --- Engine/source/console/compiledEval.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 378afd290..a18729fd4 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -1087,6 +1087,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa // This error is usually caused by failing to call Parent::initPersistFields in the class' initPersistFields(). Con::warnf(ConsoleLogEntry::General, "%s: Register object failed for object %s of class %s.", getFileLine(ip - 2), currentNewObject->getName(), currentNewObject->getClassName()); delete currentNewObject; + currentNewObject = NULL; ip = failJump; break; }