Closed tdxtxt closed 1 year ago
/** * 从数组中移除 * @param position Int * @return Int 被移除的数量 */ private fun removeNodesAt(position: Int): Int { if (position >= data.size) { return 0 } // 记录被移除的item数量 var removeCount = 0 // 先移除子项 removeCount = removeChildAt(position) // 移除node自己 this.data.removeAt(position) removeCount += 1 val node = this.data[position] // 移除脚部 if (node is NodeFooterImp && node.footerNode != null) { this.data.removeAt(position) removeCount += 1 } return removeCount }
这个方法会存在数组越界,建议作者尽快修复,修复如下
/** * 从数组中移除 * @param position Int * @return Int 被移除的数量 */ private fun removeNodesAtFix(position: Int): Int { if (position >= data.size) { return 0 } // 记录被移除的item数量,先移除子项 var removeCount = removeChildAt(position) val node = this.data[position] // 是否存在移除的脚部 val isRemoveFooter = node is NodeFooterImp && node.footerNode != null // 移除node自己 this.data.removeAt(position) removeCount += 1 // 移除脚部 if (isRemoveFooter) { this.data.removeAt(position) removeCount += 1 } return removeCount }
3.x 版本么?
是的
具体哪一行崩溃
更新依赖试试
implementation "io.github.cymchad:BaseRecyclerViewAdapterHelper:3.0.14"
这个方法会存在数组越界,建议作者尽快修复,修复如下