1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 15:07:45 +00:00

LibGUI: Fix GModel::is_valid() behavior for tree-like models

This commit is contained in:
Sergey Bugaev 2020-01-10 18:48:27 +03:00 committed by Andreas Kling
parent 303fa75d36
commit caa08938e5

View file

@ -60,7 +60,8 @@ public:
bool is_valid(const GModelIndex& index) const 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; } virtual int key_column() const { return -1; }