diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index a989826b43..d61a8f3531 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -871,6 +871,7 @@ ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thi { Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-SimObject class %s.", getFileLine(ip), (const char*)callArgv[1]); delete object; + currentNewObject = NULL; ip = failJump; break; } @@ -902,6 +903,7 @@ ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thi // Fail to create the object. delete object; + currentNewObject = NULL; ip = failJump; break; } @@ -1016,6 +1018,7 @@ ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thi Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", getFileLine(ip), currentNewObject->getName(), errorStr.c_str()); dataBlock->deleteObject(); + currentNewObject = NULL; ip = failJump; // Prevent stack value corruption diff --git a/Engine/source/core/stream/stream.cpp b/Engine/source/core/stream/stream.cpp index 8a7fb2b40a..50f99ae636 100644 --- a/Engine/source/core/stream/stream.cpp +++ b/Engine/source/core/stream/stream.cpp @@ -155,7 +155,7 @@ void Stream::readLongString(U32 maxStringLen, char *stringBuf) { U32 len; read(&len); - if(len > maxStringLen) + if(len >= maxStringLen) { m_streamStatus = IOError; return;