diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt b/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt index f0102e4b9..c335611b0 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt +++ b/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt @@ -295,11 +295,7 @@ class PlayerService : MediaBrowserServiceCompat() { } class LocalBinder internal constructor(playerService: PlayerService) : Binder() { - private val playerService: WeakReference - - init { - this.playerService = WeakReference(playerService) - } + private val playerService = WeakReference(playerService) val service: PlayerService? get() = playerService.get() @@ -322,9 +318,9 @@ class PlayerService : MediaBrowserServiceCompat() { clientPackageName: String, clientUid: Int, rootHints: Bundle? - ): BrowserRoot { + ): BrowserRoot? { // TODO check if the accessing package has permission to view data - return mediaBrowserImpl!!.onGetRoot(clientPackageName, clientUid, rootHints) + return mediaBrowserImpl?.onGetRoot(clientPackageName, clientUid, rootHints) } override fun onLoadChildren( diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/PlayerUiList.kt b/app/src/main/java/org/schabi/newpipe/player/ui/PlayerUiList.kt index b3caca205..190da81e6 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/PlayerUiList.kt +++ b/app/src/main/java/org/schabi/newpipe/player/ui/PlayerUiList.kt @@ -4,7 +4,7 @@ import org.schabi.newpipe.util.GuardedByMutex import java.util.Optional class PlayerUiList(vararg initialPlayerUis: PlayerUi) { - private var playerUis = GuardedByMutex(mutableListOf()) + private val playerUis = GuardedByMutex(mutableListOf()) /** * Creates a [PlayerUiList] starting with the provided player uis. The provided player uis