Skip to content

Commit

Permalink
Added null check safeguard
Browse files Browse the repository at this point in the history
  • Loading branch information
genius257 committed Sep 21, 2023
1 parent 5ac9fa1 commit 7dcf958
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Dom/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ public function parse(Options $options, Content $content, int $size): AbstractNo

/** @var \PHPHtmlParser\Dom\Node\HtmlNode|null $node */
$node = $tagDTO->getNode();
$activeNode->addChild($node);
if ($node !== null) {
$activeNode->addChild($node);

// check if node is self closing
if (!$node->getTag()->isSelfClosing()) {
$activeNode = $node;
// check if node is self closing
if (!$node->getTag()->isSelfClosing()) {
$activeNode = $node;
}
}
} elseif (
$options->isWhitespaceTextNode() ||
Expand Down

0 comments on commit 7dcf958

Please sign in to comment.