CymChad / CymChad/BaseRecyclerViewAdapterHelper
BaseNodeAdapter.kt中有一个bug会导致数组越界
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
`
private fun removeNodesAt(position: Int): Int {
if (position >= data.size) {
return 0
}
// 记录被移除的item数量
var removeCount = 0
// 先移除子项
removeCount = removeChildAt(position)
// 移除node自己
this.data.removeAt(position) !!!!!!!!!!!!!!注意这里, 已经移除了position处的item
removeCount += 1
val node = this.data[position] !!!!!!!!!!!!!!此时再去获取这个位置上的item,如果item总数为1, 那么这里就越界了
// 移除脚部
if (node is NodeFooterImp && node.footerNode != null) {
this.data.removeAt(position)
removeCount += 1
}
return removeCount
}
`

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to BaseNodeAdapter.kt and removeNodesAt(position). Read that method first and reproduce the single-item case described in the report; verify the removal order and footer handling without assuming an index remains valid after removal. Done means the reported ArrayIndexOutOfBoundsException no longer occurs and existing node-removal behavior is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100