From 84407aadb5c1a4e4b5f10cdb9b07b72b3ad7d6a0 Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sat, 11 Jun 2016 07:54:25 +0200 Subject: [PATCH 1/4] Fix dereferencing null if m_iActiveSound is no longer valid index by save restore. --- mp/src/game/server/envmicrophone.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mp/src/game/server/envmicrophone.cpp b/mp/src/game/server/envmicrophone.cpp index 528d7a1910..157967c09a 100644 --- a/mp/src/game/server/envmicrophone.cpp +++ b/mp/src/game/server/envmicrophone.cpp @@ -403,9 +403,8 @@ void CEnvMicrophone::Think(void) fHearSound = true; } } + nSound = pCurrentSound->NextSound(); } - - nSound = pCurrentSound->NextSound(); } if( fHearSound ) From 0ba42baffa76717754ff0a418fbfc9307a85663c Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sat, 11 Jun 2016 08:29:25 +0200 Subject: [PATCH 2/4] Forgot to break out. --- mp/src/game/server/envmicrophone.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mp/src/game/server/envmicrophone.cpp b/mp/src/game/server/envmicrophone.cpp index 157967c09a..04f044b630 100644 --- a/mp/src/game/server/envmicrophone.cpp +++ b/mp/src/game/server/envmicrophone.cpp @@ -405,6 +405,8 @@ void CEnvMicrophone::Think(void) } nSound = pCurrentSound->NextSound(); } + else + break; } if( fHearSound ) From c53f2903a894831df3ab06be384c47c4e5c5e4cb Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sat, 11 Jun 2016 08:36:02 +0200 Subject: [PATCH 3/4] One more spot fixed. --- mp/src/game/server/ai_senses.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mp/src/game/server/ai_senses.cpp b/mp/src/game/server/ai_senses.cpp index 6c302d6248..b1f2b94bca 100644 --- a/mp/src/game/server/ai_senses.cpp +++ b/mp/src/game/server/ai_senses.cpp @@ -133,7 +133,10 @@ void CAI_Senses::Listen( void ) m_iAudibleList = iSound; } - iSound = pCurrentSound->NextSound(); + if (pCurrentSound) + iSound = pCurrentSound->NextSound(); + else + break; } } From 05c33409a1e473e860fae620ab70797a67ea06d1 Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sat, 11 Jun 2016 09:52:15 +0200 Subject: [PATCH 4/4] One more. --- mp/src/game/server/ai_basenpc.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mp/src/game/server/ai_basenpc.cpp b/mp/src/game/server/ai_basenpc.cpp index 54b4763605..468d983d39 100644 --- a/mp/src/game/server/ai_basenpc.cpp +++ b/mp/src/game/server/ai_basenpc.cpp @@ -3222,7 +3222,10 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) } } - iSound = pCurrentSound->NextSound(); + if (pCurrentSound) + iSound = pCurrentSound->NextSound(); + else + break; } } @@ -3409,7 +3412,10 @@ void CAI_BaseNPC::UpdateSleepState( bool bInPVS ) break; } - iSound = pCurrentSound->NextSound(); + if (pCurrentSound) + iSound = pCurrentSound->NextSound(); + else + break; } } }