From d5e7222794392ab7c75a27afea6b6a6ce0bcdba5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 6 Mar 2015 06:59:52 +0100 Subject: [PATCH] Allow cancelling a download even if network is gone --- src/main/java/net/pterodactylus/xdcc/core/Core.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 5b1b12d..24727d9 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -339,13 +339,6 @@ public class Core extends AbstractExecutionThreadService { return; } - /* get connection. */ - Connection connection = networkConnections.get(bot.network()); - if (connection == null) { - /* request for unknown network? */ - return; - } - /* stop the DCC receiver. */ if (download.get().dccReceiver() != null) { download.get().dccReceiver().stop(); @@ -354,6 +347,13 @@ public class Core extends AbstractExecutionThreadService { downloads.remove(pack.name(), download.get()); } + /* get connection. */ + Connection connection = networkConnections.get(bot.network()); + if (connection == null) { + /* request for unknown network? */ + return; + } + /* remove the request from the bot, too. */ try { connection.sendMessage(bot.name(), String.format("XDCC %s", (download.get().dccReceiver() != null) ? "CANCEL" : "REMOVE")); -- 2.7.4