From b3781fcbf21038ebbefdc7a27f8bd124df12fbc0 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Fri, 6 Oct 2023 16:57:17 -0400 Subject: [PATCH] Add null check to clicking coupled stock --- .../entity/EntityCoupleableRollingStock.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java b/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java index b1de3064a..ca722030d 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java @@ -114,8 +114,8 @@ public ClickResult onClick(Player player, Player.Hand hand) { player.sendMessage(ChatText.COUPLER_DISENGAGED.getMessage(coupler)); } } else { - if (this.isCoupled(coupler) && this.isCouplerEngaged(coupler)) { - EntityCoupleableRollingStock coupled = this.getCoupled(coupler); + EntityCoupleableRollingStock coupled = this.getCoupled(coupler); + if (this.isCoupled(coupler) && this.isCouplerEngaged(coupler) && coupled != null) { player.sendMessage(ChatText.COUPLER_STATUS_COUPLED.getMessage( coupler, coupled.getDefinition().name(),