mirror of
https://github.com/accelforce/Yuito
synced 2025-02-12 09:30:43 +01:00
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
@ -211,10 +211,12 @@ class NotificationsFragment :
|
|||||||
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
||||||
if (positionStart == 0 && adapter.itemCount != itemCount) {
|
if (positionStart == 0 && adapter.itemCount != itemCount) {
|
||||||
binding.recyclerView.post {
|
binding.recyclerView.post {
|
||||||
|
if (getView() != null) {
|
||||||
binding.recyclerView.scrollBy(0, Utils.dpToPx(requireContext(), -30))
|
binding.recyclerView.scrollBy(0, Utils.dpToPx(requireContext(), -30))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// update post timestamps
|
// update post timestamps
|
||||||
|
Loading…
x
Reference in New Issue
Block a user