From f3d672d53dbec3d84254d56057594b5d6eff1e1c Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Mon, 28 Feb 2022 11:12:21 -0500 Subject: [PATCH] LibGUI: Support hierarchical matches in FilterProxyModel Fixes crash when searching in Help. Patch by @eggpi --- Userland/Libraries/LibGUI/FilteringProxyModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp index 9143910c0f..51102ff0aa 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp @@ -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); }