Fix crash in ViewThreadFragment.removeItem (#3622)

This commit is contained in:
Konrad Pozniak 2023-05-05 12:03:42 +02:00 committed by GitHub
parent 80774f35f8
commit d2747811be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -416,13 +416,14 @@ class ViewThreadFragment :
}
public override fun removeItem(position: Int) {
val status = adapter.currentList[position]
if (status.isDetailed) {
// the main status we are viewing is being removed, finish the activity
activity?.finish()
return
adapter.currentList.getOrNull(position)?.let { status ->
if (status.isDetailed) {
// the main status we are viewing is being removed, finish the activity
activity?.finish()
return
}
viewModel.removeStatus(status)
}
viewModel.removeStatus(status)
}
override fun onVoteInPoll(position: Int, choices: List<Int>) {