Don't try to move entries that are filtered out

This fixes a crash that could occur when changing an entry in such a
way that it is filtered out from the entry list after the change.
This commit is contained in:
Alexander Bakker 2022-12-06 18:41:29 +01:00
parent 780a215a6b
commit 4bd12f5abe

View File

@ -1,5 +1,7 @@
package com.beemdevelopment.aegis.ui.views;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import android.graphics.Typeface;
import android.os.Handler;
import android.text.SpannableString;
@ -211,7 +213,7 @@ public class EntryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
sortShownEntries();
int newPosition = _shownEntries.indexOf(newEntry);
if (position != newPosition) {
if (newPosition != NO_POSITION && position != newPosition) {
notifyItemMoved(position, newPosition);
}
} else if (!isEntryFiltered(newEntry)) {