diff --git a/packages/uebertool-companion/modules/uebertool_twig/src/Twig/Extension/TwigExtrasExtension.php b/packages/uebertool-companion/modules/uebertool_twig/src/Twig/Extension/TwigExtrasExtension.php index 8e88f0d..8c47b3f 100644 --- a/packages/uebertool-companion/modules/uebertool_twig/src/Twig/Extension/TwigExtrasExtension.php +++ b/packages/uebertool-companion/modules/uebertool_twig/src/Twig/Extension/TwigExtrasExtension.php @@ -224,10 +224,13 @@ public function linkAttributes(?array $build): Attribute { /** @var \DOMElement[] $elements */ $element = $xpath->query('//a')->item(0); - $attribute = new Attribute(array_map(function ($item) { - return $item->nodeValue; - }, iterator_to_array($element->attributes->getIterator()))); - $attribute->removeAttribute('href'); + $attribute = new Attribute(); + if ($element && $element->hasAttributes()) { + $attribute = new Attribute(array_map(function ($item) { + return $item->nodeValue; + }, iterator_to_array($element->attributes->getIterator()))); + $attribute->removeAttribute('href'); + } return $attribute; }