Ignore unrequested downloads.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2013 05:33:04 +0000 (07:33 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2013 05:33:04 +0000 (07:33 +0200)
src/main/java/net/pterodactylus/xdcc/core/Core.java

index 8aa31e2..0c66644 100644 (file)
@@ -344,6 +344,17 @@ public class Core extends AbstractIdleService {
         */
        @Subscribe
        public void dccSendReceived(DccSendReceived dccSendReceived) {
+               Optional<Network> network = getNetwork(dccSendReceived.connection());
+               if (!network.isPresent()) {
+                       return;
+               }
+
+               Download download = downloads.get(dccSendReceived.filename());
+               if (download == null) {
+                       /* unknown download, ignore. */
+                       return;
+               }
+
                logger.info(String.format("Starting download of %s.", dccSendReceived.filename()));
                try {
                        File outputFile = new File(temporaryDirectory, dccSendReceived.filename());