mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
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.
This commit is contained in:
parent
fcd4e68959
commit
0d46c27741
|
@ -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
|
GUI::ModelIndex OutlineModel::index(int row, int column, const GUI::ModelIndex& parent) const
|
||||||
{
|
{
|
||||||
if (!parent.is_valid())
|
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());
|
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());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue