X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fcore%2FCore.java;h=c0a228897ab482d22631a322cec7a6402a0a25a1;hb=8ff1daafb20619a146d0e59c285478cce209faf5;hp=5bcccf319ed8d101eae85b66a05ba2a0daca4974;hpb=b6c081057ba5fd76c5eed0ce76675a3170d80830;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 5bcccf3..c0a2288 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -435,6 +435,9 @@ public class Core extends AbstractExecutionThreadService { if (!network.isPresent()) { return; } + if (!connection.established()) { + return; + } /* find all channels that need to be removed. */ for (Collection channels : ImmutableList.of(joinedChannels, extraChannels)) { @@ -557,12 +560,16 @@ public class Core extends AbstractExecutionThreadService { return; } + Optional channel = getChannel(network.get(), channelNotJoined.channel()); + if (!channel.isPresent()) { + eventBus.post(new GenericMessage(format("Could not join %s but didn’t try to join, either.", channel.get()))); + return; + } + if (channelNotJoined.reason() == registeredNicknamesOnly) { - Optional channel = getChannel(network.get(), channelNotJoined.channel()); - if (channel.isPresent()) { - eventBus.post(new GenericMessage(format("Not trying to join %s anymore.", channel.get()))); - channels.remove(channel.get()); - } + channels.remove(channel.get()); + eventBus.post(new GenericMessage( + format("Not trying to join %s anymore.", channel.get()))); return; } if (channelNotJoined.reason() == banned) {