Skip to content
Snippets Groups Projects
Commit 40b3a672 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Fix IndexOutOfBoundsException on media delete fail

(cherry picked from commit 5cc334ce)
parent 3832e771
No related branches found
No related tags found
No related merge requests found
......@@ -332,6 +332,7 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
public void addItem(final int position, final MediaLibraryItem item) {
final ArrayList<MediaLibraryItem> referenceList = peekLast();
if (position < 0 || position >= referenceList.size()) return;
final ArrayList<MediaLibraryItem> dataList = new ArrayList<>(referenceList);
dataList.add(position,item);
update(dataList);
......
......@@ -148,6 +148,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
@MainThread
public void add(MediaWrapper item, int position) {
final ArrayList<MediaWrapper> list = new ArrayList<>(peekLast());
if (position < 0 || position >= list.size()) return;
list.add(position, item);
update(list);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment