LibGUI: Do not recurse into rows with invalid indices

That would cause the traversal to go into an infinite loop.
This commit is contained in:
AnotherTest 2020-06-30 23:02:10 +04:30 committed by Andreas Kling
commit 476ccb2206
Notes: sideshowbarker 2024-07-19 05:18:34 +09:00

View file

@ -183,6 +183,9 @@ void TreeView::traverse_in_paint_order(Callback callback) const
return IterationDecision::Continue;
}
if (indent_level > 0 && !index.is_valid())
return IterationDecision::Continue;
++indent_level;
int row_count = model.row_count(index);
for (int i = 0; i < row_count; ++i) {