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.
This commit is contained in:
Alibek Omarov 2024-07-28 14:45:36 +03:00
parent cac5852e68
commit 9a2588f7eb

View file

@ -1753,7 +1753,7 @@ static void Con_DrawNotify( void )
if( host.allow_console && ( !Cvar_VariableInteger( "cl_background" ) && !Cvar_VariableInteger( "sv_background" ))) 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 ); con_lineinfo_t *l = &CON_LINES( i );