mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +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
|
@ -108,6 +108,7 @@ JS::ThrowCompletionOr<void> ReadableStream::initialize(JS::Realm& realm)
|
|||
void ReadableStream::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
if (m_controller.has_value())
|
||||
m_controller->visit([&](auto& controller) { visitor.visit(controller); });
|
||||
visitor.visit(m_stored_error);
|
||||
visitor.visit(m_reader);
|
||||
|
|
Loading…
Reference in a new issue