소스 검색

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.
Andreas Kling 5 년 전
부모
커밋
2ad405c789
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      Libraries/LibGUI/SortingProxyModel.cpp

+ 5 - 0
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);
 }