Set the no media flag in setCurrentSong rather than in getSong

Avoids an infinite loop on startup with no media
This commit is contained in:
Christopher Eby 2010-04-04 10:16:45 -05:00
parent 238beaaef6
commit 95b94f5921

View File

@ -532,8 +532,10 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
return; return;
Song song = getSong(delta); Song song = getSong(delta);
if (song == null) if (song == null) {
setFlag(FLAG_NO_MEDIA);
return; return;
}
synchronized (mSongTimeline) { synchronized (mSongTimeline) {
mCurrentSong += delta; mCurrentSong += delta;
@ -599,10 +601,8 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
if (!song.populate()) { if (!song.populate()) {
song.randomize(); song.randomize();
if (!song.populate()) { if (!song.populate())
setFlag(FLAG_NO_MEDIA);
return null; return null;
}
} }
return song; return song;