sp/src/game/shared/ragdoll_shared.cpp: PVS-Studio: CWE-476 (NULL Pointer Dereference)

This commit is contained in:
Svyatoslav 2017-04-11 17:57:47 +03:00
parent 0d8dceea43
commit 16a1731a32

View File

@ -877,15 +877,16 @@ 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 +921,13 @@ void CRagdollLRURetirement::Update( float frametime ) // EPISODIC VERSION
CBaseAnimating *pRagdoll = m_LRU[i].Get();
if ( pRagdoll )
{
//Just ignore it until we're done burning/dissolving.
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll && (pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) ) )
if ( pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) )
continue;
}
#ifdef CLIENT_DLL
m_LRU[ i ]->SUB_Remove();