From 744e9c92ec498713d9a5c4b5103c087e6db8c82f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 28 May 2023 15:05:43 +0300 Subject: [PATCH] Prevent illegal array access (#159) When using mousewheel to switch between pages in features screen, the HandleHighLightedText() function sometimes would retain valid bHighlight index, but toggle_box_array[bHighlight] == -1, which is used to access z113FeaturesToggleText[] and would later trigger Assertion in gprintfdirty() with pFontString == NULL --- FeaturesScreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FeaturesScreen.cpp b/FeaturesScreen.cpp index 5865c4a2..92d0b60f 100644 --- a/FeaturesScreen.cpp +++ b/FeaturesScreen.cpp @@ -1517,7 +1517,7 @@ void HandleHighLightedText(BOOLEAN fHighLight) bLastRegion = -1; } - if (bHighLight != -1) + if (bHighLight != -1 && toggle_box_array[bHighLight] != -1) { if (bHighLight < OPT_FIRST_COLUMN_TOGGLE_CUT_OFF) {