Fix IndexOutOfBoundsException in onPause (#3581)
Use `getOrNull` instead of `get`, which was occasionally throwing IndexOutOfBoundsException.
This commit is contained in:
parent
d3a36be9e1
commit
2f512705e8
|
@ -453,7 +453,7 @@ class NotificationsFragment :
|
|||
// Save the ID of the first notification visible in the list
|
||||
val position = layoutManager.findFirstVisibleItemPosition()
|
||||
if (position >= 0) {
|
||||
adapter.snapshot()[position]?.id?.let { id ->
|
||||
adapter.snapshot().getOrNull(position)?.id?.let { id ->
|
||||
viewModel.accept(InfallibleUiAction.SaveVisibleId(visibleId = id))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue