From 932748ef701fc2b823e70c77646370f05447f47e Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Mon, 1 May 2017 17:56:08 +0200 Subject: [PATCH] Prevent NPEs --- .../core/service/playback/PlaybackService.java | 14 +++++++++----- 1 file 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); }