Do not crash when pressing download while service is already partially destroyed

This commit is contained in:
ByteHamster 2022-04-09 16:15:38 +02:00
parent e385d4c021
commit b751ad2aa4
1 changed files with 3 additions and 0 deletions

View File

@ -512,6 +512,9 @@ public class DownloadService extends Service {
if (isDownloadingFile(request.getSource())) { if (isDownloadingFile(request.getSource())) {
Log.d(TAG, "Skipped enqueueing request. Already running."); Log.d(TAG, "Skipped enqueueing request. Already running.");
return; 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()); Log.d(TAG, "Add new request: " + request.getSource());
if (request.getSource().startsWith(Feed.PREFIX_LOCAL_FOLDER)) { if (request.getSource().startsWith(Feed.PREFIX_LOCAL_FOLDER)) {