From e87b14468d7c2e31a0175d7989f531fed8b26d40 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 26 May 2026 02:56:36 +0500 Subject: [PATCH] ref: when entity model is NULL, the entity is player and we're drawing in menu, skip this entity silently The menu relies on the fact that model is set from player's userinfo, and if it has bogus model, it will trip on the nullptr model assert --- ref/gl/gl_rmain.c | 9 +++++++++ ref/soft/r_main.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/ref/gl/gl_rmain.c b/ref/gl/gl_rmain.c index 9504f05c..02853b80 100644 --- a/ref/gl/gl_rmain.c +++ b/ref/gl/gl_rmain.c @@ -805,6 +805,9 @@ static void R_DrawEntitiesOnList( void ) RI.currententity = tr.draw_list->solid_entities[i]; RI.currentmodel = RI.currententity->model; + if( !RI.currentmodel && RI.currententity->player && !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + continue; + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); @@ -837,6 +840,9 @@ static void R_DrawEntitiesOnList( void ) RI.currententity = tr.draw_list->solid_entities[i]; RI.currentmodel = RI.currententity->model; + if( !RI.currentmodel && RI.currententity->player && !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + continue; + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); @@ -875,6 +881,9 @@ static void R_DrawEntitiesOnList( void ) if( tr.blend <= 0.0f ) continue; + if( !RI.currentmodel && RI.currententity->player && !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + continue; + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); diff --git a/ref/soft/r_main.c b/ref/soft/r_main.c index ca5e05c2..bca07765 100644 --- a/ref/soft/r_main.c +++ b/ref/soft/r_main.c @@ -517,6 +517,9 @@ static void R_DrawEntitiesOnList( void ) RI.currentmodel = RI.currententity->model; // d_aflatcolor += 500; + if( !RI.currentmodel && RI.currententity->player && !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + continue; + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); @@ -544,6 +547,9 @@ static void R_DrawEntitiesOnList( void ) RI.currententity = tr.draw_list->solid_entities[i]; RI.currentmodel = RI.currententity->model; + if( !RI.currentmodel && RI.currententity->player && !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + continue; + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); @@ -579,6 +585,9 @@ static void R_DrawEntitiesOnList( void ) if( tr.blend <= 0.0f ) continue; + if( !RI.currentmodel && RI.currententity->player && !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + continue; + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL );