Commit 23129265 authored by Geoffrey Métais's avatar Geoffrey Métais

Prevent NPE in switchToVideo()

(cherry picked from commit d6c964c1)
parent 7fb80518
......@@ -757,17 +757,18 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
@MainThread
public boolean switchToVideo() {
if (mMediaList.getMedia(mCurrentIndex).hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || !canSwitchToVideo())
MediaWrapper media = mMediaList.getMedia(mCurrentIndex);
if (media == null || media.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || !canSwitchToVideo())
return false;
mVideoBackground = false;
if (isVideoPlaying()) {//Player is already running, just send it an intent
setVideoTrackEnabled(true);
LocalBroadcastManager.getInstance(this).sendBroadcast(
VideoPlayerActivity.getIntent(VideoPlayerActivity.PLAY_FROM_SERVICE,
getCurrentMediaWrapper(), false, mCurrentIndex));
media, false, mCurrentIndex));
} else if (!mSwitchingToVideo) {//Start the video player
VideoPlayerActivity.startOpened(VLCApplication.getAppContext(),
getCurrentMediaWrapper().getUri(), mCurrentIndex);
media.getUri(), mCurrentIndex);
mSwitchingToVideo = true;
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment