diff --git a/src/utils/modelinfomgr.cpp b/src/utils/modelinfomgr.cpp index af43e7f..2565a01 100755 --- a/src/utils/modelinfomgr.cpp +++ b/src/utils/modelinfomgr.cpp @@ -263,11 +263,19 @@ RpMaterial *ModelInfoMgr::SetEditableMaterialsCB(RpMaterial *material, void *dat if (iLightIndex == eMaterialType::SirenLight) { - lightOn = data.m_SirenStatus[GetSirenIndex(pCurVeh, material)]; + int idx = GetSirenIndex(pCurVeh, material); + if (idx >= 0 && idx < MAX_LIGHTS) + { + lightOn = data.m_SirenStatus[idx]; + } } else if (iLightIndex == eMaterialType::StrobeLight) { - lightOn = data.m_StrobeStatus[GetStrobeIndex(pCurVeh, material)]; + int idx = GetStrobeIndex(pCurVeh, material); + if (idx >= 0 && idx < MAX_LIGHTS) + { + lightOn = data.m_StrobeStatus[idx]; + } } else if (iLightIndex != eMaterialType::UnknownMaterial) {