Skip to content

collapseAllRows() causes a crash when called in didSelectRowAt #20

@swiatrzyk

Description

@swiatrzyk

I'm about to implement that when there is a child that is not expandable, then return selected cell + collapse whole treeView.
But when I call collapseAllRows() in didSelectRowAt, there goes a crash.
You can replicate that in demo project by adding:

    func treeView(_ treeView: CITreeView, didSelectRowAt treeViewNode: CITreeViewNode, at indexPath: IndexPath) {
        guard let cellData = treeViewNode.item as? CITreeViewData else {fatalError()}
        if cellData.children.isEmpty {
            self.sampleTreeView.collapseAllRows()
        }
    }

Pod version: 1.6.1
Then tap Sedan -> Alfa Romeo.
After that there goes "Index out or range error" in setExpandTreeViewNode of CTTreeViewController.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions