1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-16 06:57:04 +01:00

Merge pull request #3759 from Stypox/fix-search

Fix search crash: adapter array index out of bounds
This commit is contained in:
wb9688 2020-06-11 13:06:30 +02:00 committed by GitHub
commit caa000f447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1020,6 +1020,10 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
public int getSuggestionMovementFlags(@NonNull final RecyclerView recyclerView,
@NonNull final RecyclerView.ViewHolder viewHolder) {
final int position = viewHolder.getAdapterPosition();
if (position == RecyclerView.NO_POSITION) {
return 0;
}
final SuggestionItem item = suggestionListAdapter.getItem(position);
return item.fromHistory ? makeMovementFlags(0,
ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) : 0;