From e98f45b2796670989b9ac219cbe99f4df9845e51 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Wed, 5 Jul 2017 21:53:57 +0500 Subject: [PATCH] Merge https://github.com/ValveSoftware/halflife/pull/1599 --- dlls/weapons.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index bc508c6a..61b038c0 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -578,6 +578,13 @@ void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) } SUB_UseTargets( pOther, USE_TOGGLE, 0 ); // UNDONE: when should this happen? + + // If the item is falling and its Think remains FallItem after the player picks it up, + // then after the item touches the ground its Touch will be set back to DefaultTouch, + // so the player will pick it up again, this time Kill-ing the item (since we already have it in the inventory), + // which will make the pointer bad and crash the game. + if( m_pfnThink == &CBasePlayerItem::FallThink ) + SetThink( NULL ); } BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted )