diff options
author | ByteHamster <info@bytehamster.com> | 2022-04-09 16:02:00 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-04-09 16:02:52 +0200 |
commit | 1cc1fa1d126f1cbf375b25b715d0937bd73982f9 (patch) | |
tree | aa28049bc0a4f8a70cc4ff386876eccd1704eb1f /core/src/main/java/de/danoeh/antennapod | |
parent | 832b51de7def1f63780c285991733522e6fbd333 (diff) | |
download | AntennaPod-1cc1fa1d126f1cbf375b25b715d0937bd73982f9.zip |
Don't crash when download log entry is incomplete
Diffstat (limited to 'core/src/main/java/de/danoeh/antennapod')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java index b80a20a25..44a30da81 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java @@ -117,7 +117,9 @@ public class DownloadServiceNotification { continue; } sb.append("• ").append(statuses.get(i).getTitle()); - sb.append(": ").append(statuses.get(i).getReason().getErrorString(context)); + if (statuses.get(i).getReason() != null) { + sb.append(": ").append(statuses.get(i).getReason().getErrorString(context)); + } if (i != statuses.size() - 1) { sb.append("\n"); } @@ -134,16 +136,18 @@ public class DownloadServiceNotification { public void updateReport(List<DownloadStatus> reportQueue, boolean showAutoDownloadReport) { // check if report should be created boolean createReport = false; - int successfulDownloads = 0; int failedDownloads = 0; // a download report is created if at least one download has failed // (excluding failed image downloads) for (DownloadStatus status : reportQueue) { + if (status == null || status.isCancelled()) { + continue; + } if (status.isSuccessful()) { - successfulDownloads++; - createReport |= showAutoDownloadReport && !status.isInitiatedByUser() && status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA; - } else if (!status.isCancelled()) { + createReport |= showAutoDownloadReport && !status.isInitiatedByUser() + && status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA; + } else { failedDownloads++; createReport = true; } |