Confirm color[] length before accessing

Avoids ArrayIndexOutOfBoundsException during hasColor()
This commit is contained in:
tibs 2022-01-06 10:24:04 -05:00
parent c8d71ed083
commit d26b7ca763
Signed by untrusted user who does not match committer: tibs
GPG key ID: 047833989F50F88F

View file

@ -50,7 +50,7 @@ public class WaterCauldronBlockEntity extends BlockEntity {
}
public boolean hasColor() {
return color[0] != -1 && color[1] != -1 && color[2] != -1;
return color.length == 3 && color[0] != -1 && color[1] != -1 && color[2] != -1;
}
public int getColor() {