From 41945409d890a2c5e3eaac05cc10de119324c270 Mon Sep 17 00:00:00 2001 From: Wikot235 <149392035+Wikot235@users.noreply.github.com> Date: Sun, 25 May 2025 18:08:41 +0200 Subject: [PATCH] Fixed a crash when npc_helicopter that is awaiting input is killed (#419) --- sp/src/game/server/hl2/npc_attackchopper.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sp/src/game/server/hl2/npc_attackchopper.cpp b/sp/src/game/server/hl2/npc_attackchopper.cpp index 266cc468..efbe12e7 100644 --- a/sp/src/game/server/hl2/npc_attackchopper.cpp +++ b/sp/src/game/server/hl2/npc_attackchopper.cpp @@ -4055,9 +4055,12 @@ void CNPC_AttackHelicopter::Event_Killed( const CTakeDamageInfo &info ) } m_lifeState = LIFE_DYING; - - CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); - controller.SoundChangeVolume( m_pGunFiringSound, 0.0, 0.1f ); + + if ( GetSleepState() != AISS_WAITING_FOR_INPUT ) + { + CSoundEnvelopeController& controller = CSoundEnvelopeController::GetController(); + controller.SoundChangeVolume( m_pGunFiringSound, 0.0, 0.1f ); + } if( GetCrashPoint() == NULL ) {