From: DeaDDooMER Date: Thu, 27 Jul 2023 18:43:47 +0000 (+0300) Subject: menu: fix crash in video settings menu X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=0f4c0818f5491fc65dd95aae33bfc3c603506305;p=d2df-sdl.git menu: fix crash in video settings menu --- 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();