Skip to content

Commit

Permalink
Avoid a crash when grass color reads past it's LUT
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Feb 22, 2024
1 parent 0918f28 commit 435a6bd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ 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;
}

return GrassColor.pixels[index];
}

public static int getFoliageColor(int index) {
if (index == INVALID_INDEX) {
if (index == INVALID_INDEX || index >= FoliageColor.pixels.length) {
return DEFAULT_COLOR;
}

Expand Down

0 comments on commit 435a6bd

Please sign in to comment.