diff --git a/common/src/main/java/com/example/android/uamp/media/MusicService.kt b/common/src/main/java/com/example/android/uamp/media/MusicService.kt index 6583ae400..716c49960 100644 --- a/common/src/main/java/com/example/android/uamp/media/MusicService.kt +++ b/common/src/main/java/com/example/android/uamp/media/MusicService.kt @@ -477,14 +477,12 @@ open class MusicService : MediaBrowserServiceCompat() { PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH override fun onPrepare(playWhenReady: Boolean) { - val recentSong = storage.loadRecentSong() - recentSong?.let { - onPrepareFromMediaId( - it.mediaId!!, - playWhenReady, - it.description.extras - ) - } + val recentSong = storage.loadRecentSong() ?: return + onPrepareFromMediaId( + recentSong.mediaId!!, + playWhenReady, + recentSong.description.extras + ) } override fun onPrepareFromMediaId(