playback: fix dropped saved state on empty lib
Since ExoPlaybackStateHolder wasn't handling the new "empty library" case.
This commit is contained in:
parent
847d5aa1fc
commit
f28f2dd9f7
2 changed files with 3 additions and 3 deletions
|
@ -50,7 +50,7 @@ constructor(
|
|||
) : PersistenceRepository {
|
||||
|
||||
override suspend fun readState(): PlaybackStateManager.SavedState? {
|
||||
val library = musicRepository.library ?: return null
|
||||
val library = musicRepository.library?.takeIf { !it.empty() } ?: return null
|
||||
val playbackState: PlaybackState
|
||||
val heapItems: List<QueueHeapItem>
|
||||
val mappingItems: List<QueueShuffledMappingItem>
|
||||
|
|
|
@ -147,7 +147,7 @@ class ExoPlaybackStateHolder(
|
|||
|
||||
override fun handleDeferred(action: DeferredPlayback): Boolean {
|
||||
val library =
|
||||
musicRepository.library
|
||||
musicRepository.library?.takeIf { !it.empty() }
|
||||
// No library, cannot do anything.
|
||||
?: return false
|
||||
|
||||
|
@ -524,7 +524,7 @@ class ExoPlaybackStateHolder(
|
|||
// --- MUSICREPOSITORY METHODS ---
|
||||
|
||||
override fun onMusicChanges(changes: MusicRepository.Changes) {
|
||||
if (changes.deviceLibrary && musicRepository.library != null) {
|
||||
if (changes.deviceLibrary && musicRepository.library?.takeIf { !it.empty() } != null) {
|
||||
// We now have a library, see if we have anything we need to do.
|
||||
L.d("Library obtained, requesting action")
|
||||
playbackManager.requestAction(this)
|
||||
|
|
Loading…
Reference in a new issue