From 33f907e2372d838c992c854a8bc6ff88279bf0bc Mon Sep 17 00:00:00 2001 From: Larry Date: Mon, 24 Aug 2020 22:44:46 -0600 Subject: [PATCH] fix nullcheck --- .../draycia/carbon/commands/ChannelListCommand.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/draycia/carbon/commands/ChannelListCommand.java b/src/main/java/net/draycia/carbon/commands/ChannelListCommand.java index a2c971c8..190ae79b 100644 --- a/src/main/java/net/draycia/carbon/commands/ChannelListCommand.java +++ b/src/main/java/net/draycia/carbon/commands/ChannelListCommand.java @@ -87,17 +87,17 @@ public class ChannelListCommand extends BaseCommand { private void makeList(Iterator iterator, TextComponent.Builder list) { String listSeparator = carbonChat.getLanguage().getString("channel-list-separator"); - Component listSeparatorComponent = TextComponent.of(listSeparator); + Component listSeparatorComponent; + if (listSeparator != null) { + listSeparatorComponent = TextComponent.of(listSeparator); + } else { + listSeparatorComponent = TextComponent.of(", "); + } while (iterator.hasNext()) { ChatChannel channel = iterator.next(); list.append(TextComponent.of(channel.getName())); - if (iterator.hasNext()) { - if (listSeparator != null) { - list.append(TextComponent.of(listSeparator)); - } else { list.append(listSeparatorComponent); - } } } }