diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2020-01-10 18:48:27 +0300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-10 17:45:59 +0100 |
commit | caa08938e5c9bd399ce5bd69e09aed506d963eb4 (patch) | |
tree | 7ad84e0826d24715a44939d2079fc6ed1758ed7e | |
parent | 303fa75d365ecaa131f6d55c0c9e0f4062382c8a (diff) | |
download | serenity-caa08938e5c9bd399ce5bd69e09aed506d963eb4.zip |
LibGUI: Fix GModel::is_valid() behavior for tree-like models
-rw-r--r-- | Libraries/LibGUI/GModel.h | 3 |
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; } |