1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

LibGUI: Support hierarchical matches in FilterProxyModel

Fixes crash when searching in Help.
Patch by @eggpi
This commit is contained in:
thankyouverycool 2022-02-28 11:12:21 -05:00 committed by Andreas Kling
parent 8825abe7ed
commit f3d672d53d

View file

@ -41,8 +41,8 @@ Variant FilteringProxyModel::data(ModelIndex const& index, ModelRole role) const
if ((size_t)index.row() > m_matching_indices.size() || index.row() < 0)
return {};
// FIXME: Support hierarchical models (with a non-empty index.parent()).
auto underlying_index = m_model->index(m_matching_indices[index.row()].row(), index.column(), {});
auto matching_index = m_matching_indices[index.row()];
auto underlying_index = m_model->index(matching_index.row(), index.column(), matching_index.parent());
return underlying_index.data(role);
}