Don't crash with no songs present
I should really add an auto test for this..
This commit is contained in:
parent
a9d1941a46
commit
e8f8ff3888
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user