summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Offenhäuser <offenhaeuser@protonmail.com>2023-03-22 17:51:55 +0100
committerAndreas Kling <kling@serenityos.org>2023-03-22 22:56:24 +0100
commit0d46c277418416a5a0f78e7ac5df493fe16c65fd (patch)
tree36e5554232a5b545c294938b322f21edfbc93d33
parentfcd4e68959d20d297891411cb48ebf0040a3d708 (diff)
downloadserenity-0d46c277418416a5a0f78e7ac5df493fe16c65fd.zip
PDFViewer: Create OutlineModel items with the correct pointer
This fixes a bug where we would construct a ModelIndex with a pointer to NonnullRefPtr<OutlineItem>, instead of a pointer to the underlying OutlineItem, which caused a crash later on when we would try to dereference that pointer.
-rw-r--r--Userland/Applications/PDFViewer/OutlineModel.cpp4
1 files 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<PDF::OutlineItem*>(parent.internal_data());
- return create_index(row, column, &parent_outline_item->children[row]);
+ return create_index(row, column, parent_outline_item->children[row].ptr());
}