Only re-sort entry list when not using custom sorting

This fixes a crash introduced in #910.
This commit is contained in:
Alexander Bakker 2022-06-04 18:59:45 +02:00
parent 11d7493245
commit 1373a67ea0

View file

@ -194,6 +194,7 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
notifyItemChanged(position); notifyItemChanged(position);
if (_sortCategory != null) { if (_sortCategory != null) {
Comparator<VaultEntry> comparator = _sortCategory.getComparator(); Comparator<VaultEntry> comparator = _sortCategory.getComparator();
if (comparator != null) {
Collections.sort(_shownEntries, comparator); Collections.sort(_shownEntries, comparator);
int newPosition = Collections.binarySearch(_shownEntries, newEntry, comparator); int newPosition = Collections.binarySearch(_shownEntries, newEntry, comparator);
if (position != newPosition) { if (position != newPosition) {
@ -201,6 +202,7 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
} }
} }
} }
}
} else if (!isEntryFiltered(newEntry)) { } else if (!isEntryFiltered(newEntry)) {
_shownEntries.add(newEntry); _shownEntries.add(newEntry);