Skip to content

Commit bc806e2

Browse files
committed
Avoid crash with unreasonable state counts
1 parent a0e160c commit bc806e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Source/RunActivity/Viewer3D/Lights.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public abstract class LightPrimitive : RenderPrimitive
422422
public LightPrimitive(Light light)
423423
{
424424
Light = light;
425-
StateCount = Light.Cycle ? 2 * Light.States.Count - 2 : Light.States.Count;
425+
StateCount = Math.Max(Light.Cycle ? 2 * Light.States.Count - 2 : Light.States.Count, 1);
426426
UpdateStates(State, (State + 1) % StateCount);
427427
}
428428

0 commit comments

Comments
 (0)