Check view is non-null before scrolling, fix crash in NotificationsFragment (#3594)
The posted message runs at the end of the message queue, by which time the view may no longer exist.
This commit is contained in:
parent
2f512705e8
commit
a5578cf765
1 changed files with 3 additions and 1 deletions
|
@ -211,10 +211,12 @@ class NotificationsFragment :
|
|||
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
||||
if (positionStart == 0 && adapter.itemCount != itemCount) {
|
||||
binding.recyclerView.post {
|
||||
if (getView() != null) {
|
||||
binding.recyclerView.scrollBy(0, Utils.dpToPx(requireContext(), -30))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// update post timestamps
|
||||
|
|
Loading…
Reference in a new issue