Skip to content

Commit

Permalink
Fix Null Pointer Dereference ValveSoftware#416
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium authored Feb 27, 2024
1 parent 1ed86a6 commit f6cd180
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions sp/src/game/shared/ragdoll_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,15 +877,15 @@ void CRagdollLRURetirement::Update( float frametime ) // EPISODIC VERSION

for ( i = m_LRU.Head(); i < m_LRU.InvalidIndex(); i = next )
{
CBaseAnimating *pRagdoll = m_LRU[i].Get();

next = m_LRU.Next(i);
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll && (pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) ) )
continue;
CBaseAnimating *pRagdoll = m_LRU[i].Get();

if ( pRagdoll )
{
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) )
continue;

// float distToPlayer = (pPlayer->GetAbsOrigin() - pRagdoll->GetAbsOrigin()).LengthSqr();
float distToPlayer = (PlayerOrigin - pRagdoll->GetAbsOrigin()).LengthSqr();

Expand Down Expand Up @@ -920,10 +920,13 @@ void CRagdollLRURetirement::Update( float frametime ) // EPISODIC VERSION

CBaseAnimating *pRagdoll = m_LRU[i].Get();

//Just ignore it until we're done burning/dissolving.
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll && (pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) ) )
continue;
if ( pRagdoll )
{
//Just ignore it until we're done burning/dissolving.
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) )
continue;
}

#ifdef CLIENT_DLL
m_LRU[ i ]->SUB_Remove();
Expand Down

0 comments on commit f6cd180

Please sign in to comment.