From 435a6bd7ecfa58499b64f1a73b61309070929d86 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Thu, 22 Feb 2024 13:11:49 -0800 Subject: [PATCH] Avoid a crash when grass color reads past it's LUT --- .../mods/sodium/client/world/biome/BiomeColorMaps.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/caffeinemc/mods/sodium/client/world/biome/BiomeColorMaps.java b/src/main/java/net/caffeinemc/mods/sodium/client/world/biome/BiomeColorMaps.java index 0e3ff9f521..42807ed6cf 100644 --- a/src/main/java/net/caffeinemc/mods/sodium/client/world/biome/BiomeColorMaps.java +++ b/src/main/java/net/caffeinemc/mods/sodium/client/world/biome/BiomeColorMaps.java @@ -11,7 +11,7 @@ public class BiomeColorMaps { private static final int DEFAULT_COLOR = 0xffff00ff; public static int getGrassColor(int index) { - if (index == INVALID_INDEX) { + if (index == INVALID_INDEX || index >= GrassColor.pixels.length) { return DEFAULT_COLOR; } @@ -19,7 +19,7 @@ public static int getGrassColor(int index) { } public static int getFoliageColor(int index) { - if (index == INVALID_INDEX) { + if (index == INVALID_INDEX || index >= FoliageColor.pixels.length) { return DEFAULT_COLOR; }