From a2f62f1e9c8a5d4b5700c6351cf4aa6b742c94b9 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:05:26 -0700 Subject: [PATCH] Fix #505 --- .../draycia/carbon/common/channels/CarbonChannelRegistry.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/net/draycia/carbon/common/channels/CarbonChannelRegistry.java b/common/src/main/java/net/draycia/carbon/common/channels/CarbonChannelRegistry.java index 0776eb1e..fb994fb5 100644 --- a/common/src/main/java/net/draycia/carbon/common/channels/CarbonChannelRegistry.java +++ b/common/src/main/java/net/draycia/carbon/common/channels/CarbonChannelRegistry.java @@ -408,7 +408,8 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann // TODO: trigger platform events related to chat this.sendMessageInChannel(player, chatChannel, message); } else { - if (this.config.primaryConfig().returnToDefaultChannel() && player.selectedChannel().key().equals(channelKey)) { + final @Nullable ChatChannel fromChannel = player.selectedChannel(); + if (this.config.primaryConfig().returnToDefaultChannel() && fromChannel != null && fromChannel.key().equals(channelKey)) { chatChannel = this.defaultChannel(); }