From efb3cf490d6552ee1c2e7fbf2c1dd077dd5d88c2 Mon Sep 17 00:00:00 2001 From: Jay Turner Date: Fri, 22 Mar 2024 13:38:56 +0000 Subject: [PATCH] Add null-safety check on usage of BlockEntity.loadStatic (#6224) --- .../create/foundation/utility/BlockHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index 6435dbd49..4d229b2a5 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -298,10 +298,12 @@ public class BlockHelper { if (data != null) { if (existingBlockEntity instanceof IMergeableBE mergeable) { BlockEntity loaded = BlockEntity.loadStatic(target, state, data); - if (existingBlockEntity.getType() - .equals(loaded.getType())) { - mergeable.accept(loaded); - return; + if (loaded != null) { + if (existingBlockEntity.getType() + .equals(loaded.getType())) { + mergeable.accept(loaded); + return; + } } } BlockEntity blockEntity = world.getBlockEntity(target);