summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2020-01-10 18:48:27 +0300
committerAndreas Kling <awesomekling@gmail.com>2020-01-10 17:45:59 +0100
commitcaa08938e5c9bd399ce5bd69e09aed506d963eb4 (patch)
tree7ad84e0826d24715a44939d2079fc6ed1758ed7e
parent303fa75d365ecaa131f6d55c0c9e0f4062382c8a (diff)
downloadserenity-caa08938e5c9bd399ce5bd69e09aed506d963eb4.zip
LibGUI: Fix GModel::is_valid() behavior for tree-like models
-rw-r--r--Libraries/LibGUI/GModel.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GModel.h b/Libraries/LibGUI/GModel.h
index b0adb39289..c241cd23fc 100644
--- a/Libraries/LibGUI/GModel.h
+++ b/Libraries/LibGUI/GModel.h
@@ -60,7 +60,8 @@ public:
bool is_valid(const GModelIndex& index) const
{
- return index.row() >= 0 && index.row() < row_count() && index.column() >= 0 && index.column() < column_count();
+ auto parent_index = this->parent_index(index);
+ return index.row() >= 0 && index.row() < row_count(parent_index) && index.column() >= 0 && index.column() < column_count(parent_index);
}
virtual int key_column() const { return -1; }