From 0f7d9d029fedcb36b96797feb6d0f82051390e09 Mon Sep 17 00:00:00 2001 From: SanyaSho Date: Wed, 3 Aug 2022 17:19:43 +0300 Subject: [PATCH] game: fix ent_create crash if entity model is NULL --- game/server/ai_basenpc.cpp | 6 ++++++ public/bone_setup.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/game/server/ai_basenpc.cpp b/game/server/ai_basenpc.cpp index 0acc458f..25fbc0c3 100644 --- a/game/server/ai_basenpc.cpp +++ b/game/server/ai_basenpc.cpp @@ -6560,6 +6560,12 @@ float CAI_BaseNPC::ThrowLimit( const Vector &vecStart, //----------------------------------------------------------------------------- void CAI_BaseNPC::SetupVPhysicsHull() { + if( GetModelPtr() == NULL ) + { + UTIL_Remove( this ); + return; + } + if ( GetMoveType() == MOVETYPE_VPHYSICS || GetMoveType() == MOVETYPE_NONE ) return; diff --git a/public/bone_setup.cpp b/public/bone_setup.cpp index 564f9ea6..8302b8f5 100644 --- a/public/bone_setup.cpp +++ b/public/bone_setup.cpp @@ -5943,6 +5943,8 @@ const char *Studio_GetDefaultSurfaceProps( CStudioHdr *pstudiohdr ) float Studio_GetMass( CStudioHdr *pstudiohdr ) { + if( pstudiohdr == NULL ) return 0.f; + return pstudiohdr->mass(); }