Skip to content

Commit be4a5a5

Browse files
authored
Merge pull request #10576 from AudricV/fix-npe-feed-new-items-button
Fix crash when setting the masking of the new feed items button if the context is null
2 parents 3dc593f + 9fab0ec commit be4a5a5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,9 +607,13 @@ class FeedFragment : BaseStateFragment<FeedState>() {
607607
execOnEnd = {
608608
// Disabled animations would result in immediately hiding the button
609609
// after it showed up
610-
if (DeviceUtils.hasAnimationsAnimatorDurationEnabled(context)) {
611-
// Hide the new items-"popup" after 10s
612-
hideNewItemsLoaded(true, 10000)
610+
// Context can be null in some cases, so we have to make sure it is not null in
611+
// order to avoid a NullPointerException
612+
context?.let {
613+
if (DeviceUtils.hasAnimationsAnimatorDurationEnabled(it)) {
614+
// Hide the new items button after 10s
615+
hideNewItemsLoaded(true, 10000)
616+
}
613617
}
614618
}
615619
)

0 commit comments

Comments
 (0)