fix NPE when media is 'uncastable'
This commit is contained in:
parent
4c81f0217d
commit
232ec987b5
@ -701,7 +701,7 @@ public class PlaybackService extends Service {
|
|||||||
boolean isInQueue = false;
|
boolean isInQueue = false;
|
||||||
FeedItem nextItem = null;
|
FeedItem nextItem = null;
|
||||||
|
|
||||||
if (playable instanceof FeedMedia) {
|
if (playable instanceof FeedMedia && ((FeedMedia) playable).getItem() != null) {
|
||||||
FeedMedia media = (FeedMedia) playable;
|
FeedMedia media = (FeedMedia) playable;
|
||||||
FeedItem item = media.getItem();
|
FeedItem item = media.getItem();
|
||||||
|
|
||||||
|
@ -264,6 +264,11 @@ public class RemotePSMP extends PlaybackServiceMediaPlayer {
|
|||||||
if (!CastUtils.isCastable(playable)) {
|
if (!CastUtils.isCastable(playable)) {
|
||||||
Log.d(TAG, "media provided is not compatible with cast device");
|
Log.d(TAG, "media provided is not compatible with cast device");
|
||||||
callback.onMediaPlayerInfo(CAST_ERROR_PRIORITY_HIGH, R.string.cast_not_castable);
|
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);
|
callback.endPlayback(playable, startWhenPrepared, true, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user