From b751ad2aa47a709e88bba4524f3e3dfd0aabb840 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 9 Apr 2022 16:15:38 +0200 Subject: [PATCH] Do not crash when pressing download while service is already partially destroyed --- .../antennapod/core/service/download/DownloadService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index 42340e704..128b7a65d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -512,6 +512,9 @@ public class DownloadService extends Service { if (isDownloadingFile(request.getSource())) { Log.d(TAG, "Skipped enqueueing request. Already running."); return; + } else if (downloadHandleExecutor.isShutdown()) { + Log.d(TAG, "Skipped enqueueing request. Service is already shutting down."); + return; } Log.d(TAG, "Add new request: " + request.getSource()); if (request.getSource().startsWith(Feed.PREFIX_LOCAL_FOLDER)) {