diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-01-05 01:40:52 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-01-05 01:48:10 +0100 |
commit | 2d2cf2f933207b0230dce14d9fdd95ed4ae6fba2 (patch) | |
tree | f5439e7d062db5f80c4d3b4e4cae390cc7b151b3 | |
parent | 07d378cffded21626289e96a2730cc65dd67d1e2 (diff) | |
download | AntennaPod-2d2cf2f933207b0230dce14d9fdd95ed4ae6fba2.zip |
Prevent NPE if media was not found
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java index 9d7a509cf..582538fb8 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java @@ -134,12 +134,16 @@ public class DownloadLogAdapter extends BaseAdapter { } } else if(holder.typeId == FeedMedia.FEEDFILETYPE_FEEDMEDIA) { FeedMedia media = DBReader.getFeedMedia(holder.id); - try { - DBTasks.downloadFeedItems(context, media.getItem()); - Toast.makeText(context, R.string.status_downloading_label, Toast.LENGTH_SHORT).show(); - } catch (DownloadRequestException e) { - e.printStackTrace(); - DownloadRequestErrorDialogCreator.newRequestErrorDialog(context, e.getMessage()); + if (media != null) { + try { + DBTasks.downloadFeedItems(context, media.getItem()); + Toast.makeText(context, R.string.status_downloading_label, Toast.LENGTH_SHORT).show(); + } catch (DownloadRequestException e) { + e.printStackTrace(); + DownloadRequestErrorDialogCreator.newRequestErrorDialog(context, e.getMessage()); + } + } else { + Log.wtf(TAG, "Could not find media for id: " + holder.id); } } else { Log.wtf(TAG, "Unexpected type id: " + holder.typeId); |