From 7bdd0e13614dd257825a968f039933cb81876c87 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 31 Oct 2017 02:09:39 +0000 Subject: [PATCH] Crash fix git-svn-id: https://svn.eduke32.com/eduke32@6493 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gamedef.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 96afb9e62..5cf109818 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -6444,17 +6444,17 @@ void C_Compile(const char *fileName) for (int i = 0; i < MAXEVENTS; ++i) { + if (!apScriptGameEventEnd[i]) + continue; + intptr_t *eventEnd = apScript + apScriptGameEventEnd[i]; - if (eventEnd) + // C_FillEventBreakStackWithEndEvent + intptr_t *breakPtr = (intptr_t*)*(eventEnd + 2); + while (breakPtr) { - // C_FillEventBreakStackWithEndEvent - intptr_t *breakPtr = (intptr_t*)*(eventEnd + 2); - while (breakPtr) - { - breakPtr = apScript + (intptr_t)breakPtr; - *(breakPtr-2) = CON_ENDEVENT | (g_lineNumber << 12); - breakPtr = (intptr_t*)*breakPtr; - } + breakPtr = apScript + (intptr_t)breakPtr; + *(breakPtr-2) = CON_ENDEVENT | (g_lineNumber << 12); + breakPtr = (intptr_t*)*breakPtr; } }