diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-25 22:55:44 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-25 22:55:44 +0200 |
commit | 8a3d00ac025562ee45efae73fcccd0ac3cde0e1e (patch) | |
tree | cd8b875297ed39b157ab4c87668682639970de4c /LibGUI | |
parent | e2e2c783326eca1583c2a42cbd02ecb2ec630daa (diff) | |
download | serenity-8a3d00ac025562ee45efae73fcccd0ac3cde0e1e.zip |
GTableView: Double-click should only activate/edit valid indices.
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GTableView.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/LibGUI/GTableView.cpp b/LibGUI/GTableView.cpp index 326b08241c..fbca110db3 100644 --- a/LibGUI/GTableView.cpp +++ b/LibGUI/GTableView.cpp @@ -318,11 +318,14 @@ void GTableView::doubleclick_event(GMouseEvent& event) { if (!model()) return; + auto& model = *this->model(); if (event.button() == GMouseButton::Left) { mousedown_event(event); - if (is_editable()) - begin_editing(model()->selected_index()); - else - model()->activate(model()->selected_index()); + if (model.selected_index().is_valid()) { + if (is_editable()) + begin_editing(model.selected_index()); + else + model.activate(model.selected_index()); + } } } |