mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
LibWeb: Check for active document in descendant_navigables()
This is not in the spec, but I did see a null pointer dereference here while browsing the web, and it seems completely harmless for this function to skip over navigables without an active document. (cherry picked from commit 56e1c0e7eec813c311c41696063a3a31b4b14f0d)
This commit is contained in:
1 parent
0897967771
commit
c2d89a02c7
1 file changed
+5
-1
@@ -3108,7 +3108,11 @@ Vector<JS::Handle<HTML::Navigable>> Document::descendant_navigables()
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
// 2. Extend navigables with navigableContainer's content navigable's active document's inclusive descendant navigables.
|
||||
navigables.extend(navigable_container.content_navigable()->active_document()->inclusive_descendant_navigables());
|
||||
auto document = navigable_container.content_navigable()->active_document();
|
||||
// AD-HOC: If the descendant navigable doesn't have an active document, just skip over it.
|
||||
if (!document)
|
||||
return TraversalDecision::Continue;
|
||||
navigables.extend(document->inclusive_descendant_navigables());
|
||||
}
|
||||
return TraversalDecision::Continue;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user