1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 04:22:30 +01:00

Fix crash when setting the masking of the new feed items button if the context is null

As the fragment context can be null in some cases, we have to make sure that
the context is not null before calling
DeviceUtils.hasAnimationsAnimatorDurationEnabled.

If the context is null, the button will now not be hidden automatically.
This commit is contained in:
AudricV 2023-11-15 00:37:05 +01:00
parent 6d694518fe
commit 9fab0ec94f
No known key found for this signature in database
GPG Key ID: DA92EC7905614198

View File

@ -607,11 +607,15 @@ class FeedFragment : BaseStateFragment<FeedState>() {
execOnEnd = {
// Disabled animations would result in immediately hiding the button
// after it showed up
if (DeviceUtils.hasAnimationsAnimatorDurationEnabled(context)) {
// Hide the new items-"popup" after 10s
// Context can be null in some cases, so we have to make sure it is not null in
// order to avoid a NullPointerException
context?.let {
if (DeviceUtils.hasAnimationsAnimatorDurationEnabled(it)) {
// Hide the new items button after 10s
hideNewItemsLoaded(true, 10000)
}
}
}
)
}