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

Prevent NPE in switchToVideo()

parent 1a586537
......@@ -750,17 +750,18 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
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
getCurrentMediaWrapper(), false, mCurrentIndex));
media, false, mCurrentIndex));
} else if (!mSwitchingToVideo) {//Start the video player
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