Prevent NPEs
This commit is contained in:
parent
293fb131e6
commit
932748ef70
|
@ -368,14 +368,18 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
}
|
}
|
||||||
|
|
||||||
private MediaBrowserCompat.MediaItem createBrowsableMediaItemForFeed(Feed feed) {
|
private MediaBrowserCompat.MediaItem createBrowsableMediaItemForFeed(Feed feed) {
|
||||||
MediaDescriptionCompat description = new MediaDescriptionCompat.Builder()
|
MediaDescriptionCompat.Builder builder = new MediaDescriptionCompat.Builder()
|
||||||
.setMediaId("FeedId:" + Long.toString(feed.getId()))
|
.setMediaId("FeedId:" + Long.toString(feed.getId()))
|
||||||
.setTitle(feed.getTitle())
|
.setTitle(feed.getTitle())
|
||||||
.setDescription(feed.getDescription())
|
.setDescription(feed.getDescription())
|
||||||
.setIconUri(Uri.parse(feed.getImageLocation()))
|
.setSubtitle(feed.getCustomTitle());
|
||||||
.setSubtitle(feed.getCustomTitle())
|
if(feed.getImageLocation() != null) {
|
||||||
.setMediaUri(Uri.parse(feed.getLink()))
|
builder.setIconUri(Uri.parse(feed.getImageLocation()));
|
||||||
.build();
|
}
|
||||||
|
if(feed.getLink() != null) {
|
||||||
|
builder.setMediaUri(Uri.parse(feed.getLink()));
|
||||||
|
}
|
||||||
|
MediaDescriptionCompat description = builder.build();
|
||||||
return new MediaBrowserCompat.MediaItem(description,
|
return new MediaBrowserCompat.MediaItem(description,
|
||||||
MediaBrowserCompat.MediaItem.FLAG_BROWSABLE);
|
MediaBrowserCompat.MediaItem.FLAG_BROWSABLE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue