Fix style and add comment about null player

This commit is contained in:
Stypox 2025-02-24 14:21:05 +01:00 committed by GitHub
parent 4bc8e09271
commit 1b7a4c5b86

View file

@ -319,11 +319,8 @@ public final class PlayerService extends MediaBrowserServiceCompat {
public void setPlayerListener(@Nullable final Consumer<Player> listener) {
this.onPlayerStartedOrStopped = listener;
if (listener != null) {
if (player == null) {
listener.accept(null);
} else {
listener.accept(player);
}
// if there is no player, then `null` will be sent here, to ensure the state is synced
listener.accept(player);
}
}
//endregion