Skip to content

Commit

Permalink
simplified null checking
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgCantor committed Sep 1, 2020
1 parent ea7c375 commit 6c3ff37
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6c3ff37

Please sign in to comment.