mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 23:56:06 +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
Notes:
sideshowbarker
2024-07-17 09:49:33 +09:00
Author: https://github.com/janso3
Commit: 0d46c27741
Pull-request: https://github.com/SerenityOS/serenity/pull/17990
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue