Ensure document is not falsey before attempting to clone it

This commit is contained in:
Steve Boyd 2019-01-16 16:24:45 +13:00
parent 074cf04b60
commit 7ea218aa1c

View File

@ -35,7 +35,11 @@ abstract class HTMLValue extends ViewableData
*/
public function getContent()
{
$doc = clone $this->getDocument();
$document = $this->getDocument();
if (!$document) {
return '';
}
$doc = clone $document;
$xp = new DOMXPath($doc);
// If there's no body, the content is empty string