Fix possible NPE if BlockElement is null

This commit is contained in:
Lukas Rieger (Blue) 2023-03-26 00:32:33 +01:00
parent 8af13df3f9
commit 1f8d2464a0
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
1 changed files with 3 additions and 2 deletions

View File

@ -61,7 +61,7 @@ public class BlockModel {
if (this.elements != null) {
for (var element : elements) {
element.optimize(resourcePack);
if (element != null) element.optimize(resourcePack);
}
}
}
@ -86,6 +86,7 @@ public class BlockModel {
if (this.elements == null && parent.elements != null) {
this.elements = new Element[parent.elements.length];
for (int i = 0; i < this.elements.length; i++){
if (parent.elements[i] == null) continue;
this.elements[i] = parent.elements[i].copy();
}
}
@ -101,7 +102,7 @@ public class BlockModel {
public synchronized void calculateProperties(ResourcePack resourcePack) {
if (elements == null) return;
for (Element element : elements) {
if (element.isFullCube()) {
if (element != null && element.isFullCube()) {
occluding = true;
culling = true;