Page Content: Better handling for empty content filtering

For #6028
This commit is contained in:
Dan Brown
2026-02-19 23:25:00 +00:00
parent a8d96fd389
commit 80204518a2
2 changed files with 26 additions and 1 deletions

View File

@@ -103,7 +103,13 @@ class HtmlDocument
*/
public function getBody(): DOMNode
{
return $this->document->getElementsByTagName('body')[0];
$bodies = $this->document->getElementsByTagName('body');
if ($bodies->length === 0) {
return new DOMElement('body', '');
}
return $bodies[0];
}
/**