From 9a2588f7eb7b8eb791b48d198b07aa95892bb8af Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 28 Jul 2024 14:45:36 +0300 Subject: [PATCH] engine: client: console: fix a rare crash when we're in game, console is enabled but it's empty With ui_allowconsole toggle it's easy to reproduce: join game without console, go to menu, enable console and return back to game. --- engine/client/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/client/console.c b/engine/client/console.c index e7b3aee8..0cd893da 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -1753,7 +1753,7 @@ static void Con_DrawNotify( void ) if( host.allow_console && ( !Cvar_VariableInteger( "cl_background" ) && !Cvar_VariableInteger( "sv_background" ))) { - for( i = CON_LINES_COUNT - con.num_times; i < CON_LINES_COUNT; i++ ) + for( i = Q_max( 0, CON_LINES_COUNT - con.num_times ); i < CON_LINES_COUNT; i++ ) { con_lineinfo_t *l = &CON_LINES( i );