Merge pull request #387 from alexey-lysiuk/fix_unknown_pcode_crash

Fixed potential crash in ACS engine
This commit is contained in:
coelckers 2015-09-16 15:32:19 +02:00
commit 029fa1e691

View file

@ -6032,6 +6032,7 @@ int DLevelScript::RunScript ()
int sp = 0; int sp = 0;
int *pc = this->pc; int *pc = this->pc;
ACSFormat fmt = activeBehavior->GetFormat(); ACSFormat fmt = activeBehavior->GetFormat();
FBehavior* const savedActiveBehavior = activeBehavior;
unsigned int runaway = 0; // used to prevent infinite loops unsigned int runaway = 0; // used to prevent infinite loops
int pcd; int pcd;
FString work; FString work;
@ -6065,6 +6066,7 @@ int DLevelScript::RunScript ()
{ {
default: default:
Printf ("Unknown P-Code %d in %s\n", pcd, ScriptPresentation(script).GetChars()); Printf ("Unknown P-Code %d in %s\n", pcd, ScriptPresentation(script).GetChars());
activeBehavior = savedActiveBehavior;
// fall through // fall through
case PCD_TERMINATE: case PCD_TERMINATE:
DPrintf ("%s finished\n", ScriptPresentation(script).GetChars()); DPrintf ("%s finished\n", ScriptPresentation(script).GetChars());