From c4753af497ec7bb9e97f8b25c44d41cd26be1a8d Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 30 Jan 2019 09:36:52 +0000 Subject: [PATCH] Fix issue where a useless error would be printed to the log and bad memory reads could occur when compiling a CON script with an invalid structure member passed as gamevar structure access shortcut shorthand git-svn-id: https://svn.eduke32.com/eduke32@7323 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gamedef.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 82790d8ed..78aa0e84c 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -1500,11 +1500,13 @@ static void C_GetNextVarType(int32_t type) case STRUCT_ACTORVAR: case STRUCT_PLAYERVAR: labelNum = GetDefID(LAST_LABEL); break; + } - default: - g_errorCnt++; - C_ReportError(ERROR_NOTAMEMBER); - return; + if (labelNum == -1) + { + g_errorCnt++; + C_ReportError(ERROR_NOTAMEMBER); + return; } switch (id - g_structVarIDs)