diff --git a/sp/src/game/shared/ragdoll_shared.cpp b/sp/src/game/shared/ragdoll_shared.cpp index e77e9a755d..4c585c0ded 100644 --- a/sp/src/game/shared/ragdoll_shared.cpp +++ b/sp/src/game/shared/ragdoll_shared.cpp @@ -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(); @@ -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();