Skip to content

Commit 4b32890

Browse files
committed
Fix random crash in SubscriptionFragment
1 parent a41aa01 commit 4b32890

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
422422
feedGroupsSortMenuItem.showSortButton = groups.size > 1
423423
feedGroupsSortMenuItem.listViewMode = listViewMode
424424
binding.itemsList.post {
425+
if (context == null) {
426+
// since this part was posted to the next UI cycle, the fragment might have been
427+
// removed in the meantime
428+
return@post
429+
}
430+
425431
feedGroupsCarousel.notifyChanged(FeedGroupCarouselItem.PAYLOAD_UPDATE_LIST_VIEW_MODE)
426432
feedGroupsSortMenuItem.notifyChanged(GroupsHeader.PAYLOAD_UPDATE_ICONS)
427433

0 commit comments

Comments
 (0)