From 2ad405c78989676ea9374eaebab9dd8bb8fb4b86 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 24 Feb 2020 20:54:27 +0100 Subject: [PATCH] LibGUI: Complain in SortingProxyModel::data() if map_to_target() fails There is some sort of issue with using a SortingProxyModel together with ColumnsView. This is a workaround to allow FilePicker to use a MultiView for now, but this needs to be fixed separately somehow. --- Libraries/LibGUI/SortingProxyModel.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Libraries/LibGUI/SortingProxyModel.cpp b/Libraries/LibGUI/SortingProxyModel.cpp index 2244e8a00e..25ebec08ac 100644 --- a/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Libraries/LibGUI/SortingProxyModel.cpp @@ -81,6 +81,11 @@ Model::ColumnMetadata SortingProxyModel::column_metadata(int index) const Variant SortingProxyModel::data(const ModelIndex& index, Role role) const { + auto target_index = map_to_target(index); + if (!target_index.is_valid()) { + dbg() << "BUG! SortingProxyModel: Unable to convert " << index << " to target"; + return {}; + } return target().data(map_to_target(index), role); }