Skip to content

Commit be3c51c

Browse files
committed
修复偶尔删除item后重展开复现的bug
修复偶尔删除item后重展开复现的bug
1 parent d296d1f commit be3c51c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

library/src/main/java/com/chad/library/adapter/base/BaseMultiItemQuickAdapter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ public void remove(@IntRange(from = 0L) int position) {
8484
protected void removeAllChild(IExpandable parent, int parentPosition) {
8585
if (parent.isExpanded()) {
8686
List<MultiItemEntity> chidChilds = parent.getSubItems();
87+
if (chidChilds == null || chidChilds.size() == 0) return;
88+
8789
int childSize = chidChilds.size();
88-
if (null != chidChilds && childSize > 0) {
89-
for (int i = 0; i < childSize; i++) {
90-
remove(parentPosition + 1);
91-
}
90+
for (int i = 0; i < childSize; i++) {
91+
remove(parentPosition + 1);
9292
}
9393
}
9494
}
@@ -100,7 +100,7 @@ protected void removeAllChild(IExpandable parent, int parentPosition) {
100100
*/
101101
protected void removeDataFromParent(T child) {
102102
int position = getParentPosition(child);
103-
if(position > 0){
103+
if (position >= 0) {
104104
IExpandable parent = (IExpandable) mData.get(position);
105105
parent.getSubItems().remove(child);
106106
}

0 commit comments

Comments
 (0)