1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibWeb: Don't choose destroyed navigables in choose a navigable AO

There's a chance that we try to choose a navigable before a previously
destroyed navigable is fully destroyed and GC'd. Investigating why this
can happen is a separate endeavor, let's just not crash for now.
This commit is contained in:
Andrew Kaster 2024-02-12 17:34:03 -07:00 committed by Andreas Kling
parent eaa568210f
commit a0e7af0cd9

View file

@ -312,7 +312,7 @@ Navigable::ChosenNavigable Navigable::choose_a_navigable(StringView name, Tokeni
JS::GCPtr<Navigable> same_name_navigable = nullptr;
if (!Infra::is_ascii_case_insensitive_match(name, "_blank"sv)) {
for (auto& n : all_navigables()) {
if (n->target_name() == name) {
if (n->target_name() == name && !n->has_been_destroyed()) {
same_name_navigable = n;
}
}