Don't crash when download log entry is incomplete
This commit is contained in:
parent
832b51de7d
commit
1cc1fa1d12
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue