Ignore unrequested downloads.
[xudocci.git] / 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());