Commit 5cc334ce authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Fix IndexOutOfBoundsException on media delete fail

parent 6ad0a79d
......@@ -333,6 +333,7 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
public void addItem(final int position, final MediaLibraryItem item) {
final List<MediaLibraryItem> referenceList = peekLast();
if (position < 0 || position >= referenceList.size()) return;
final List<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 List<MediaWrapper> list = new ArrayList<>(peekLast());
if (position < 0 || position >= list.size()) return;
list.add(position, item);
update(list);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment