diff options
author | Domingos Lopes <domingos86lopes+github@gmail.com> | 2016-05-07 14:10:37 -0400 |
---|---|---|
committer | Domingos Lopes <domingos86lopes+github@gmail.com> | 2016-05-07 14:10:37 -0400 |
commit | 232ec987b5c3ceb17a1e845d4a056a701da9b22e (patch) | |
tree | e9ad3abaa375cd2b758a522bc84b4a5d0b4b3e44 /core | |
parent | 4c81f0217daac53e160db54089f6b5fa8a526272 (diff) | |
download | AntennaPod-232ec987b5c3ceb17a1e845d4a056a701da9b22e.zip |
fix NPE when media is 'uncastable'
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 2 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java | 5 |
2 files changed, 6 insertions, 1 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 b66826c0c..e6d41879c 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 @@ -701,7 +701,7 @@ public class PlaybackService extends Service { boolean isInQueue = false; FeedItem nextItem = null; - if (playable instanceof FeedMedia) { + if (playable instanceof FeedMedia && ((FeedMedia) playable).getItem() != null) { FeedMedia media = (FeedMedia) playable; FeedItem item = media.getItem(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java index 287bb1776..4262b8a70 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java @@ -264,6 +264,11 @@ public class RemotePSMP extends PlaybackServiceMediaPlayer { if (!CastUtils.isCastable(playable)) { Log.d(TAG, "media provided is not compatible with cast device"); callback.onMediaPlayerInfo(CAST_ERROR_PRIORITY_HIGH, R.string.cast_not_castable); + try { + playable.loadMetadata(); + } catch (Playable.PlayableException e) { + Log.e(TAG, "Unable to load metadata of playable", e); + } callback.endPlayback(playable, startWhenPrepared, true, false); return; } |