From 0f4c0818f5491fc65dd95aae33bfc3c603506305 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Thu, 27 Jul 2023 21:43:47 +0300 Subject: [PATCH] menu: fix crash in video settings menu --- src/game/g_menu.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index f021de3..ff6757f 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -1988,7 +1988,7 @@ begin if list <> nil then begin Items := list; - ItemIndex := Length(list) + ItemIndex := -1; (* nothing selected *) end else begin @@ -2004,7 +2004,7 @@ begin TempResScale := Round(r_pixel_scale - 1); with TGUISwitch(menu.GetControl('swResFactor')) do - ItemIndex := Min(TempResScale, gRC_Width div 640 - 1); + ItemIndex := Max(Min(TempResScale, gRC_Width div 640 - 1), 0); end; procedure ProcApplyVideoOptions(); -- 2.11.4.GIT