From 0d46c277418416a5a0f78e7ac5df493fe16c65fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= Date: Wed, 22 Mar 2023 17:51:55 +0100 Subject: [PATCH] PDFViewer: Create OutlineModel items with the correct pointer This fixes a bug where we would construct a ModelIndex with a pointer to NonnullRefPtr, instead of a pointer to the underlying OutlineItem, which caused a crash later on when we would try to dereference that pointer. --- Userland/Applications/PDFViewer/OutlineModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp index 81eb841a1a..57adf27cec 100644 --- a/Userland/Applications/PDFViewer/OutlineModel.cpp +++ b/Userland/Applications/PDFViewer/OutlineModel.cpp @@ -130,8 +130,8 @@ GUI::ModelIndex OutlineModel::parent_index(const GUI::ModelIndex& index) const GUI::ModelIndex OutlineModel::index(int row, int column, const GUI::ModelIndex& parent) const { if (!parent.is_valid()) - return create_index(row, column, &m_outline->children[row]); + return create_index(row, column, m_outline->children[row].ptr()); auto parent_outline_item = static_cast(parent.internal_data()); - return create_index(row, column, &parent_outline_item->children[row]); + return create_index(row, column, parent_outline_item->children[row].ptr()); }