diff --git a/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt b/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt index 5f66c76b93..3fc1117733 100644 --- a/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt +++ b/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt @@ -57,14 +57,13 @@ class PlaybackService : MediaLibraryService() { release() } - override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaLibrarySession? { - return session.takeUnless { session -> - session.invokeIsReleased - }.also { - if (it == null) { - Logger.e("onGetSession returns null because the session is already released") - } - } + override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaLibrarySession { + if (session.invokeIsReleased) + rootComponentAs() + .playbackComponentFactory + .create(this) + .inject(this) + return session } } diff --git a/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt b/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt index ddf30b419c..11d856b35f 100644 --- a/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt +++ b/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt @@ -44,7 +44,7 @@ class BookSearchHandler // Look for anything that might match the query private suspend fun searchUnstructured(query: String?): Book? { - if (query != null) { + if (!query.isNullOrBlank()) { val foundMatch = findBook { val bookNameMatches = it.content.name.contains(query, ignoreCase = true) val authorMatches = it.content.author?.contains(query, ignoreCase = true) == true