From 8c5db5f9807ec6a9cd1c943b08cfb5dccd7a882b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 5 Nov 2024 22:44:03 +0300 Subject: [PATCH] engine: client: turn some asserts in texture remap code into proper nullptr checks --- engine/client/cl_remap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engine/client/cl_remap.c b/engine/client/cl_remap.c index c16f58c1..d8aec4f1 100644 --- a/engine/client/cl_remap.c +++ b/engine/client/cl_remap.c @@ -134,7 +134,8 @@ static void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotex break; // found } - Assert( tx != NULL ); + if( !tx ) + return; // backup original palette pal = (byte *)(tx + 1) + (tx->width * tx->height); @@ -175,7 +176,8 @@ static void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptext Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mdlname, name ); index = ref.dllFuncs.GL_FindTexture( texname ); - if( !index ) return; // couldn't find texture + if( !index ) + return; // couldn't find texture // search for pixels for( i = 0; i < entity->model->numtextures; i++ ) @@ -185,7 +187,8 @@ static void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptext break; // found } - Assert( tx != NULL ); + if( !tx ) + return; // couldn't find texture // backup original palette pal = (byte *)(tx + 1) + (tx->width * tx->height);