From dfbfc4565062bdfc8bb91a04536de146f61de3c8 Mon Sep 17 00:00:00 2001 From: Eric Lemieux Date: Mon, 28 Dec 2020 15:20:17 -0500 Subject: [PATCH] Fix null pointer exception in play button method When the play queue was null, and this method was called a null pointer exception would be thrown. This change adds an additional check to see if the play queue is not null before making additional changes. --- .../org/schabi/newpipe/player/VideoPlayerImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java index a304b44300b..dc7d371ae9c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java @@ -1069,12 +1069,17 @@ public int getOverrideResolutionIndex(final List sortedVideos, // States //////////////////////////////////////////////////////////////////////////*/ - private void animatePlayButtons(final boolean show, final int duration) { + private void animatePlayButtons(boolean show, final int duration) { animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, show, duration); - if (playQueue.getIndex() > 0 || !show) { + + if (playQueue == null) { + show = false; + } + + if (!show || playQueue.getIndex() > 0) { animateView(playPreviousButton, AnimationUtils.Type.SCALE_AND_ALPHA, show, duration); } - if (playQueue.getIndex() + 1 < playQueue.getStreams().size() || !show) { + if (!show || playQueue.getIndex() + 1 < playQueue.getStreams().size()) { animateView(playNextButton, AnimationUtils.Type.SCALE_AND_ALPHA, show, duration); }