Prevent crash

pull/209/head
M66B 2 years ago
parent 9ff9600256
commit fac57be4bc

@ -2762,6 +2762,7 @@ public class FragmentMessages extends FragmentBase
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
try {
int pos = viewHolder.getAdapterPosition();
if (pos == NO_POSITION) {
adapter.notifyDataSetChanged();
@ -2849,6 +2850,18 @@ public class FragmentMessages extends FragmentBase
onSwipeDelete(message, pos);
else
swipeFolder(message, action);
} catch (Throwable ex) {
Log.e(ex);
/*
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling ...
at androidx.recyclerview.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView:3185)
at androidx.recyclerview.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView:5712)
at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView:12674)
at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView:12664)
at androidx.recyclerview.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView:7599)
at eu.faircode.email.FragmentMessages$60.onSwiped(FragmentMessages:2818)
*/
}
}
private TupleMessageEx getMessage(int pos) {

Loading…
Cancel
Save