Browse Source

game: fix ent_create crash if entity model is NULL

pull/100/head
SanyaSho 2 years ago
parent
commit
0f7d9d029f
  1. 6
      game/server/ai_basenpc.cpp
  2. 2
      public/bone_setup.cpp

6
game/server/ai_basenpc.cpp

@ -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;

2
public/bone_setup.cpp

@ -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();
} }

Loading…
Cancel
Save