From f087d6d8656d03850d304f4ec1406a94c857dc10 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 4 Apr 2023 22:08:43 -0700 Subject: [PATCH] ST_drawDebugInfo: fix displayplayers access out of bounds on startup On startup, the cvar is not registered yet so the value went negative subtracting from zero. --- src/st_stuff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index a48d844d5..6c66d069d 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -438,8 +438,10 @@ void ST_drawDebugInfo(void) { INT32 height = 192; + const UINT8 screen = cv_devmode_screen.value - 1; + // devmode_screen = 1..4 - stplyr = &players[displayplayers[min(r_splitscreen, cv_devmode_screen.value - 1)]]; + stplyr = &players[displayplayers[min(r_splitscreen, screen)]]; if (!stplyr->mo) return;