diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2017-05-01 17:56:08 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2017-05-01 18:07:37 +0200 |
commit | 932748ef701fc2b823e70c77646370f05447f47e (patch) | |
tree | 586ec11597877da931b03d93cc6fdd9e54a185ac /core | |
parent | 293fb131e60bb5755a6d3293f4554c4f9ad01e76 (diff) | |
download | AntennaPod-932748ef701fc2b823e70c77646370f05447f47e.zip |
Prevent NPEs
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index e620da0bd..b3200923b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -368,14 +368,18 @@ public class PlaybackService extends MediaBrowserServiceCompat { } private MediaBrowserCompat.MediaItem createBrowsableMediaItemForFeed(Feed feed) { - MediaDescriptionCompat description = new MediaDescriptionCompat.Builder() + MediaDescriptionCompat.Builder builder = new MediaDescriptionCompat.Builder() .setMediaId("FeedId:" + Long.toString(feed.getId())) .setTitle(feed.getTitle()) .setDescription(feed.getDescription()) - .setIconUri(Uri.parse(feed.getImageLocation())) - .setSubtitle(feed.getCustomTitle()) - .setMediaUri(Uri.parse(feed.getLink())) - .build(); + .setSubtitle(feed.getCustomTitle()); + if(feed.getImageLocation() != null) { + builder.setIconUri(Uri.parse(feed.getImageLocation())); + } + if(feed.getLink() != null) { + builder.setMediaUri(Uri.parse(feed.getLink())); + } + MediaDescriptionCompat description = builder.build(); return new MediaBrowserCompat.MediaItem(description, MediaBrowserCompat.MediaItem.FLAG_BROWSABLE); } |