Skip to content

Commit

Permalink
LibWeb: Add missing navigable null check in Document::open()
Browse files Browse the repository at this point in the history
I saw a null pointer dereference here on GitHub once, but don't know how
to reproduce, or how we'd get here. Nevertheless, null-checking the
navigable is reasonable so let's do it.
  • Loading branch information
awesomekling committed May 23, 2024
1 parent 63a56a7 commit 9c20553
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/DOM/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ WebIDL::ExceptionOr<Document*> Document::open(Optional<String> const&, Optional<
// If document belongs to a child navigable, we need to make sure its initial navigation is done,
// because subsequent steps will modify "initial about:blank" to false, which would cause
// initial navigation to fail in case it was "about:blank".
if (auto navigable = this->navigable(); navigable->container() && !navigable->container()->content_navigable_initialized()) {
if (auto navigable = this->navigable(); navigable && navigable->container() && !navigable->container()->content_navigable_initialized()) {
HTML::main_thread_event_loop().spin_processing_tasks_with_source_until(HTML::Task::Source::NavigationAndTraversal, [navigable_container = navigable->container()] {
return navigable_container->content_navigable_initialized();
});
Expand Down

0 comments on commit 9c20553

Please sign in to comment.