diff --git a/sp/src/game/client/colorcorrectionmgr.cpp b/sp/src/game/client/colorcorrectionmgr.cpp index cf1210ac..f04438d6 100644 --- a/sp/src/game/client/colorcorrectionmgr.cpp +++ b/sp/src/game/client/colorcorrectionmgr.cpp @@ -157,6 +157,22 @@ void CColorCorrectionMgr::CommitColorCorrectionWeights() } m_colorCorrectionWeights.RemoveAll(); } + +void CColorCorrectionMgr::LevelShutdownPreEntity() +{ + //Clean up the vectors when shuting down a level + //will keep dangling pointers inside of the vector causing a nullptr crash + if (g_ColorCorrectionVolumeList.Base()) + { + g_ColorCorrectionVolumeList.Purge(); + } + + if (g_ColorCorrectionList.Base()) + { + g_ColorCorrectionList.Purge(); + } +} + #else void CColorCorrectionMgr::SetColorCorrectionWeight( ClientCCHandle_t h, float flWeight ) { diff --git a/sp/src/game/client/colorcorrectionmgr.h b/sp/src/game/client/colorcorrectionmgr.h index 3eba0f8c..8492ac20 100644 --- a/sp/src/game/client/colorcorrectionmgr.h +++ b/sp/src/game/client/colorcorrectionmgr.h @@ -76,6 +76,8 @@ private: CUtlVector< SetWeightParams_t > m_colorCorrectionWeights; void CommitColorCorrectionWeights(); + + void LevelShutdownPreEntity(); #endif };