From ed6692cf2afcd066eb4d19cf14960c7b0fc0da46 Mon Sep 17 00:00:00 2001 From: mittorn Date: Sat, 4 Aug 2018 22:00:46 +0700 Subject: [PATCH] Fix null pointer deference --- dlls/enttools.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/enttools.cpp b/dlls/enttools.cpp index 9bcfaae0..9d862db9 100644 --- a/dlls/enttools.cpp +++ b/dlls/enttools.cpp @@ -506,7 +506,10 @@ void Ent_Fire_f( edict_t *player ) return; ent = g_engfuncs.pfnPEntityOfEntIndex( i ); - if( ent->serialnumber != atoi( cmd ) ) + if( ent && ent->serialnumber != atoi( cmd ) ) + return; + + if( !Ent_IsValidEdict( ent ) ) return; } else