Эх сурвалжийг харах

CInterface integration in CodeInterpreter null ptr fix

mNSEntry can be null if there is no TorqueScript defintion, but there could still be a result from an externally defined source.
´
Furthermore fixes an issue where StringStackConsoleWrapper would die before the value was read.
Lukas Joergensen 6 жил өмнө
parent
commit
c9609fbdbf

+ 5 - 4
Engine/source/console/codeInterpreter.cpp

@@ -2181,14 +2181,15 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
 
    // ConsoleFunctionType is for any function defined by script.
    // Any 'callback' type is an engine function that is exposed to script.
-   if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType
-      || cFunctionRes)
+   if (cFunctionRes || mNSEntry->mType == Namespace::Entry::ConsoleFunctionType)
    {
+      ConsoleValue retVal;
       ConsoleValueRef ret;
       if (cFunctionRes)
       {
-         StringStackConsoleWrapper retVal(1, &cRetRes);
-         ret = retVal.argv[0];
+         retVal.init();
+         ret.value = &retVal;
+         retVal.setStackStringValue(cRetRes);
       }
       else if (mNSEntry->mFunctionOffset)
       {