summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-25 22:55:44 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-25 22:55:44 +0200
commit8a3d00ac025562ee45efae73fcccd0ac3cde0e1e (patch)
treecd8b875297ed39b157ab4c87668682639970de4c /LibGUI
parente2e2c783326eca1583c2a42cbd02ecb2ec630daa (diff)
downloadserenity-8a3d00ac025562ee45efae73fcccd0ac3cde0e1e.zip
GTableView: Double-click should only activate/edit valid indices.
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GTableView.cpp11
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());
+ }
}
}