mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +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
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
Add a link
Reference in a new issue