From 02f678dccc8b6a635b07f9a96b20aed7b3b5b9ce Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 24 Jan 2017 11:59:59 +0100 Subject: [PATCH] - there seem to be ACS compilers which let 'delay' pass inside a function. Since this is an unsupported feature which brings the ACS VM into an unstable state it has to be handled with a hard abort to avoid crashes. --- src/p_acs.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 50f50ff31..24142e0ec 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -9716,7 +9716,16 @@ scriptwait: if (runaway != 0 && InModuleScriptNumber >= 0) { - activeBehavior->GetScriptPtr(InModuleScriptNumber)->ProfileData.AddRun(runaway); + auto scriptptr = activeBehavior->GetScriptPtr(InModuleScriptNumber); + if (scriptptr != nullptr) + { + scriptptr->ProfileData.AddRun(runaway); + } + else + { + // It is pointless to continue execution. The script is broken and needs to be aborted. + I_Error("Bad script definition encountered. Script %d is reported running but not present.\nThe most likely cause for this message is using 'delay' inside a function which is not supported.\nPlease check the ACS compiler used for compiling the script!", InModuleScriptNumber); + } } if (state == SCRIPT_DivideBy0)