game: fix ent_create crash if entity model is NULL

This commit is contained in:
SanyaSho 2022-08-03 17:19:43 +03:00
parent 1aa326b7f2
commit 0f7d9d029f
2 changed files with 8 additions and 0 deletions

View File

@ -6560,6 +6560,12 @@ float CAI_BaseNPC::ThrowLimit( const Vector &vecStart,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CAI_BaseNPC::SetupVPhysicsHull() void CAI_BaseNPC::SetupVPhysicsHull()
{ {
if( GetModelPtr() == NULL )
{
UTIL_Remove( this );
return;
}
if ( GetMoveType() == MOVETYPE_VPHYSICS || GetMoveType() == MOVETYPE_NONE ) if ( GetMoveType() == MOVETYPE_VPHYSICS || GetMoveType() == MOVETYPE_NONE )
return; return;

View File

@ -5943,6 +5943,8 @@ const char *Studio_GetDefaultSurfaceProps( CStudioHdr *pstudiohdr )
float Studio_GetMass( CStudioHdr *pstudiohdr ) float Studio_GetMass( CStudioHdr *pstudiohdr )
{ {
if( pstudiohdr == NULL ) return 0.f;
return pstudiohdr->mass(); return pstudiohdr->mass();
} }