mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
Mail: Fix crash caused by migration from NonnullRefPtrVector
When we moved from NonnullRefPtrVector<T> to Vector<NonnullRefPtr<T>>
in commit 8a48246ed1
, the `at()` function
started returning a NonnullRefPtr<T>& instead of T&.
The code calling create_index() was not then updated and ended up taking
a pointer to a temporary NonnullRefPtr<>, instead of an actual object,
leading to a crash after logging in.
This commit is contained in:
parent
dfcd5ffaba
commit
bd853de716
Notes:
sideshowbarker
2024-07-17 20:19:08 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/bd853de716 Pull-request: https://github.com/SerenityOS/serenity/pull/19808
1 changed files with 3 additions and 3 deletions
|
@ -21,17 +21,17 @@ GUI::ModelIndex MailboxTreeModel::index(int row, int column, GUI::ModelIndex con
|
|||
if (!parent.is_valid()) {
|
||||
if (m_account_holder.accounts().is_empty())
|
||||
return {};
|
||||
return create_index(row, column, &m_account_holder.accounts().at(row));
|
||||
return create_index(row, column, m_account_holder.accounts().at(row));
|
||||
}
|
||||
auto& base_node = *static_cast<BaseNode*>(parent.internal_data());
|
||||
|
||||
if (is<MailboxNode>(base_node)) {
|
||||
auto& remote_mailbox = verify_cast<MailboxNode>(base_node);
|
||||
return create_index(row, column, &remote_mailbox.children().at(row));
|
||||
return create_index(row, column, remote_mailbox.children().at(row));
|
||||
}
|
||||
|
||||
auto& remote_parent = verify_cast<AccountNode>(base_node);
|
||||
return create_index(row, column, &remote_parent.mailboxes().at(row));
|
||||
return create_index(row, column, remote_parent.mailboxes().at(row));
|
||||
}
|
||||
|
||||
GUI::ModelIndex MailboxTreeModel::parent_index(GUI::ModelIndex const& index) const
|
||||
|
|
Loading…
Add table
Reference in a new issue