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 ) for ( i = m_LRU.Head(); i < m_LRU.InvalidIndex(); i = next )
{ {
CBaseAnimating *pRagdoll = m_LRU[i].Get();
next = m_LRU.Next(i); next = m_LRU.Next(i);
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll && (pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) ) ) CBaseAnimating *pRagdoll = m_LRU[i].Get();
continue;
if ( pRagdoll ) if ( pRagdoll )
{ {
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) )
continue;
// float distToPlayer = (pPlayer->GetAbsOrigin() - pRagdoll->GetAbsOrigin()).LengthSqr(); // float distToPlayer = (pPlayer->GetAbsOrigin() - pRagdoll->GetAbsOrigin()).LengthSqr();
float distToPlayer = (PlayerOrigin - 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(); CBaseAnimating *pRagdoll = m_LRU[i].Get();
//Just ignore it until we're done burning/dissolving. if ( pRagdoll )
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject(); {
if ( pRagdoll && (pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) ) ) //Just ignore it until we're done burning/dissolving.
continue; IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) )
continue;
}
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
m_LRU[ i ]->SUB_Remove(); m_LRU[ i ]->SUB_Remove();