mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Do not dereference empty Optional in ReadableStream::visit_edges
There are quite a few steps between a ReadableStream being created and its controller being set. If GC occurs between those points, we will have an empty Optional in ReadableStream::visit_edges. Seen on YouTube.
This commit is contained in:
parent
9be5dcfd89
commit
781287c1e3
Notes:
sideshowbarker
2024-07-17 03:14:39 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/781287c1e3 Pull-request: https://github.com/SerenityOS/serenity/pull/18367
1 changed files with 2 additions and 1 deletions
|
@ -108,7 +108,8 @@ JS::ThrowCompletionOr<void> ReadableStream::initialize(JS::Realm& realm)
|
|||
void ReadableStream::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
m_controller->visit([&](auto& controller) { visitor.visit(controller); });
|
||||
if (m_controller.has_value())
|
||||
m_controller->visit([&](auto& controller) { visitor.visit(controller); });
|
||||
visitor.visit(m_stored_error);
|
||||
visitor.visit(m_reader);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue