Skip to content

Commit 1f8d246

Browse files
committed
Fix possible NPE if BlockElement is null
1 parent 8af13df commit 1f8d246

File tree

1 file changed

+3
-2
lines changed
  • BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/blockmodel

1 file changed

+3
-2
lines changed

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/blockmodel/BlockModel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public synchronized void optimize(ResourcePack resourcePack) {
6161

6262
if (this.elements != null) {
6363
for (var element : elements) {
64-
element.optimize(resourcePack);
64+
if (element != null) element.optimize(resourcePack);
6565
}
6666
}
6767
}
@@ -86,6 +86,7 @@ public synchronized void applyParent(ResourcePack resourcePack) {
8686
if (this.elements == null && parent.elements != null) {
8787
this.elements = new Element[parent.elements.length];
8888
for (int i = 0; i < this.elements.length; i++){
89+
if (parent.elements[i] == null) continue;
8990
this.elements[i] = parent.elements[i].copy();
9091
}
9192
}
@@ -101,7 +102,7 @@ private synchronized void applyTextureVariable(String key, TextureVariable value
101102
public synchronized void calculateProperties(ResourcePack resourcePack) {
102103
if (elements == null) return;
103104
for (Element element : elements) {
104-
if (element.isFullCube()) {
105+
if (element != null && element.isFullCube()) {
105106
occluding = true;
106107

107108
culling = true;

0 commit comments

Comments
 (0)