From 393c18a338f8985105378d660fc92290048f9c2f Mon Sep 17 00:00:00 2001 From: Dmitry Tsarevich Date: Mon, 9 Dec 2024 14:43:10 +0300 Subject: [PATCH] [game/shared] Fix nullptr ragdoll dereference in episode 1 & 2 https://github.com/ValveSoftware/source-sdk-2013/pull/416 --- game/shared/ragdoll_shared.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/game/shared/ragdoll_shared.cpp b/game/shared/ragdoll_shared.cpp index 6475c9e4d..fa48765b2 100644 --- a/game/shared/ragdoll_shared.cpp +++ b/game/shared/ragdoll_shared.cpp @@ -882,15 +882,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();