From 1630d87c0d3b1a7c4dcec3c62979164bfe751699 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 15 Mar 2023 04:58:33 +0300 Subject: [PATCH] engine: client: do not alter the state if invalid HANDLE was passed to pfnSPR_Set. Fixes Half-Life: MMod --- engine/client/cl_game.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 907daf81..fe3a71ad 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -1417,7 +1417,13 @@ pfnSPR_Set */ static void GAME_EXPORT pfnSPR_Set( HSPRITE hPic, int r, int g, int b ) { - clgame.ds.pSprite = CL_GetSpritePointer( hPic ); + const model_t *sprite = CL_GetSpritePointer( hPic ); + + // a1ba: do not alter the state if invalid HSPRITE was passed + if( !sprite ) + return; + + clgame.ds.pSprite = sprite; clgame.ds.spriteColor[0] = bound( 0, r, 255 ); clgame.ds.spriteColor[1] = bound( 0, g, 255 ); clgame.ds.spriteColor[2] = bound( 0, b, 255 );