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