From cc96ac173c5b9755bd0c7ffa6d798b8ee1604ab6 Mon Sep 17 00:00:00 2001 From: TiA4f8R <74829229+TiA4f8R@users.noreply.github.com> Date: Tue, 16 Nov 2021 19:25:46 +0100 Subject: [PATCH] Apply suggestion --- .../org/schabi/newpipe/player/Player.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index bec120baa..771827c20 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -3003,25 +3003,18 @@ public final class Player implements final MediaSourceTag metadata; try { final MediaItem currentMediaItem = simpleExoPlayer.getCurrentMediaItem(); - if (currentMediaItem != null) { - final MediaItem.PlaybackProperties playbackProperties = - currentMediaItem.playbackProperties; - metadata = (MediaSourceTag) (playbackProperties != null ? playbackProperties.tag - : null); - } else { - metadata = null; + if (currentMediaItem == null || currentMediaItem.playbackProperties == null + || currentMediaItem.playbackProperties.tag == null) { + return; } - } catch (final IndexOutOfBoundsException | ClassCastException error) { + metadata = (MediaSourceTag) currentMediaItem.playbackProperties.tag; + } catch (final IndexOutOfBoundsException | ClassCastException ex) { if (DEBUG) { - Log.d(TAG, "Could not update metadata: " + error.getMessage()); - error.printStackTrace(); + Log.d(TAG, "Could not update metadata", ex); } return; } - if (metadata == null) { - return; - } maybeAutoQueueNextStream(metadata); if (currentMetadata == metadata) {