-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix null pointer exception in play button method #5301
Conversation
Thanks for finding this. If show is false, the view would be set to GONE which should be preferred instead of doing nothing. So I would suggest to change I think when the queue is not available it doesn't make sense to ever show the playPreviousButton. |
Is there a reason why the play queue can be null in the first place? Also how did you produce the crash, what steps where necessary? |
c80968a
to
dfbfc45
Compare
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.
dfbfc45
to
0a05534
Compare
@Redirion I have updated the logic to match what you were describing. When I removed final from show, checkStyle didn't like that so I created a new variable to be used. CheckStyle is still complaining, but about things that I didn't change. @XiangRongLin I wasn't able to create a reproducible way of causing this crash, the issue originally happened after switching back to the app after some time, so it could be caused by a cache being cleared while the app is in the background. This doesn't seem to be a wide spread issue as I haven't seen anyone else with the issue and I have only seen it happen once. |
thank you @EricLemieux what you could do so that we can maybe someday invest more work to find the root cause is to add a warning log:
within your null check @XiangRongLin I don't think this is a big issue that would require immediate action to find the root cause. So I would prefer to just merge this fix to make the app more resilient. Do you agree? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Redirion
Thank you! :-D
Fine by me |
First time looking into the source for NewPipe, if anything needs to be updated or done in a different way let me know and I will be happy to update.
What is it?
Description of the changes in your PR
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.
Fixes the following issue(s)
I didn't open an issue, because this seemed like a such a small straightforward issue. I did search and didn't see any other related issues.
This is the error I got from the app, where I can see a NPE being thrown in the animatePlayButtons method, when getting the index of the play queue.
APK testing
I don't currently have a apk for testing, if this is required I can look into generating one.
Due diligence