diff --git a/src/PHPHtmlParser/Dom/Node/TextNode.php b/src/PHPHtmlParser/Dom/Node/TextNode.php
index 1c8b646c..63572da0 100644
--- a/src/PHPHtmlParser/Dom/Node/TextNode.php
+++ b/src/PHPHtmlParser/Dom/Node/TextNode.php
@@ -53,7 +53,7 @@ public function __construct(string $text, $removeDoubleSpace = true)
if ($replacedText === false) {
throw new LogicalException('mb_ereg_replace returns false when attempting to clean white space from "' . $text . '".');
}
- $text = $replacedText;
+ $text = $replacedText ?: '';
}
// restore line breaks