Don't crash with no songs present

I should really add an auto test for this..
This commit is contained in:
Christopher Eby committed 2010-03-10 22:32:46 -06:00
1 parent a9d1941a46
commit e8f8ff3888
1 file changed
+9 -2
+9 -2
View File
@@ -157,7 +157,8 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
Log.d("VanillaMusic", "destroy");
saveState(true);
if (mSongs != null)
saveState(true);
if (mMediaPlayer != null) {
MediaPlayer player = mMediaPlayer;
@@ -467,6 +468,9 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
}
Song song = getSong(0);
if (song == null)
return;
broadcastSongChange(song);
boolean cancelNotification = updateNotification();
@@ -659,8 +663,11 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
}
if (!song.populate()) {
if (mSongs == null)
return null;
song.id = randomSong();
song.populate();
if (!song.populate())
return null;
}
return song;