mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
TreeView: Don't try to move cursor with invalid index
When clicking on the TreeView in profiler without selecting a node and then pressing up or pgup, cursor_index was in an invalid state. Instead select the first node in the index.
This commit is contained in:
parent
f295ac3c0b
commit
94551149d1
1 changed files with 3 additions and 0 deletions
|
@ -480,6 +480,9 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up
|
|||
{
|
||||
auto& model = *this->model();
|
||||
|
||||
if (!cursor_index().is_valid())
|
||||
set_cursor(model.index(0, model.tree_column(), cursor_index()), SelectionUpdate::Set);
|
||||
|
||||
auto find_last_index_in_tree = [&](const ModelIndex tree_index) -> ModelIndex {
|
||||
auto last_index = tree_index;
|
||||
size_t row_count = model.row_count(last_index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue