Skip to content

Commit

Permalink
Fix null pointer exception in play button method
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EricLemieux committed Dec 29, 2020
1 parent 90d3c9c commit dfbfc45
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1069,12 +1069,17 @@ public int getOverrideResolutionIndex(final List<VideoStream> 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);
}

Expand Down

0 comments on commit dfbfc45

Please sign in to comment.