mirror of
https://github.com/Tencent/QMUI_Android.git
synced 2026-10-29 03:26:44 +08:00
add bounds protection
This commit is contained in:
@@ -102,7 +102,7 @@ public abstract class QMUIItemViewsAdapter<T, V extends View> {
|
||||
if (mItemData == null) {
|
||||
return null;
|
||||
}
|
||||
if (position < 0 || position > mItemData.size()) {
|
||||
if (position < 0 || position >= mItemData.size()) {
|
||||
return null;
|
||||
}
|
||||
return mItemData.get(position);
|
||||
|
||||
@@ -710,9 +710,10 @@ public class QMUITabSegment extends HorizontalScrollView {
|
||||
} else {
|
||||
targetIndex = index + 1;
|
||||
}
|
||||
|
||||
TabAdapter tabAdapter = getAdapter();
|
||||
final List<TabItemView> listViews = tabAdapter.getViews();
|
||||
if (listViews.size() < index || listViews.size() < targetIndex) {
|
||||
if (listViews.size() <= index || listViews.size() <= targetIndex) {
|
||||
return;
|
||||
}
|
||||
Tab preModel = tabAdapter.getItem(index);
|
||||
|
||||
Reference in New Issue
Block a user