diff --git a/Runtime/Graphics/CCubeRenderer.cpp b/Runtime/Graphics/CCubeRenderer.cpp index eb933a373..c30e98aa0 100644 --- a/Runtime/Graphics/CCubeRenderer.cpp +++ b/Runtime/Graphics/CCubeRenderer.cpp @@ -519,6 +519,10 @@ void CCubeRenderer::ActivateLightsForModel(const CAreaListItem* areaItem, CCubeM u32 lightIdx = 0; for (const auto& light : x300_dynamicLights) { + if (lightIdx >= LightCount) { + break; + } + if (lightOctreeWords == nullptr || TestBit(lightOctreeWords, model.GetIndex())) { bool loaded = false; const float radius =