Clamp lightcolor to prevent ArrayIndexOutOfBounds (#62)

This commit is contained in:
Yoshy authored and GitHub committed 2025-08-31 16:30:33 -04:00
1 parent cd09920557
commit 69b6bc0560
1 file changed
+1 -1
@@ -84,7 +84,7 @@ public class CosmicRenderShenanigans {
int mx = (coord % 65536) / 16;
int my = (coord / 65536) / 16;
int lightcolour = map[my * 16 + mx];
int lightcolour = map[Math.max(0, Math.min(map.length - 1, my * 16 + mx))];
setLightLevel(
((lightcolour >> 16) & 0xFF) / 256.0f,