Skip to content

Commit 0d89f3f

Browse files
committed
VideoGroupObjectAdapter: fix ArrayIndexOutOfBoundsException
1 parent 534abbe commit 0d89f3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/adapter/VideoGroupObjectAdapter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
import java.util.ArrayList;
1313
import java.util.List;
14+
import java.util.concurrent.CopyOnWriteArrayList;
1415

1516
public class VideoGroupObjectAdapter extends ObjectAdapter {
1617
private static final WeakHashSet<VideoGroupObjectAdapter> sAdapterRegistry = new WeakHashSet<>();
1718
private final List<Video> mVideoItems = new ArrayList<>();
18-
private final List<VideoGroup> mVideoGroups = new ArrayList<>(); // keep groups from being garbage collected
19+
// CopyOnWriteArrayList to fix Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=10; index=-1
20+
private final List<VideoGroup> mVideoGroups = new CopyOnWriteArrayList<>(); // keep groups from being garbage collected
1921
private static final int TYPE_ADD = 0;
2022
private static final int TYPE_REMOVE = 1;
2123
private static final int TYPE_SYNC = 2;

0 commit comments

Comments
 (0)