Prevent NPE

This commit is contained in:
Martin Fietz 2016-11-12 09:25:10 +01:00
parent aab9f51077
commit 4a6b630e56
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package de.danoeh.antennapod.core.feed;
import android.database.Cursor;
import android.support.annotation.Nullable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -269,6 +270,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
}
}
@Nullable
public FeedMedia getMedia() {
return media;
}

View File

@ -301,7 +301,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
List<MediaSessionCompat.QueueItem> queueItems = new ArrayList<>();
try {
for (FeedItem feedItem : taskManager.getQueue()) {
queueItems.add(new MediaSessionCompat.QueueItem(feedItem.getMedia().getMediaItem().getDescription(), feedItem.getId()));
if(feedItem.getMedia() != null) {
MediaDescriptionCompat mediaDescription = feedItem.getMedia().getMediaItem().getDescription();
queueItems.add(new MediaSessionCompat.QueueItem(mediaDescription, feedItem.getId()));
}
}
mediaSession.setQueue(queueItems);
} catch (InterruptedException e) {