From 7eb023dd00ece784835d29c72dddc8404505d675 Mon Sep 17 00:00:00 2001 From: JeroenT Date: Wed, 21 Apr 2021 09:41:50 +0000 Subject: [PATCH] Update UrlExtractor.php --- src/UrlExtractor.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/UrlExtractor.php b/src/UrlExtractor.php index c6a03a4..6f89617 100644 --- a/src/UrlExtractor.php +++ b/src/UrlExtractor.php @@ -51,11 +51,12 @@ class UrlExtractor { return $this->getUrlFromEntity($input, $relative); } elseif ($input instanceof EntityReferenceFieldItemListInterface) { - if ($item = $input->first()) { + $item = $input->first(); + if (!empty($item) && $input->entity instanceof ContentEntityInterface) { return $this->getUrlFromEntity($item->entity, $relative); } } - elseif ($input instanceof EntityReferenceItem) { + elseif ($input instanceof EntityReferenceItem && $input->entity instanceof ContentEntityInterface) { return $this->getUrlFromEntity($input->entity, $relative); } elseif ($input instanceof LinkItemInterface) {