From eb906c93bdb20b11bd3701dc51efd19d6b3aa23c Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Mon, 20 Aug 2018 15:08:31 -0500 Subject: [PATCH] Check for the parent before we getValue (#95) --- src/IslandoraUtils.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/IslandoraUtils.php b/src/IslandoraUtils.php index 41fd44ba..23b5f0d3 100644 --- a/src/IslandoraUtils.php +++ b/src/IslandoraUtils.php @@ -107,10 +107,13 @@ class IslandoraUtils { if ($field->isEmpty()) { return NULL; } - return $field->first() + $parent = $field->first() ->get('entity') - ->getTarget() - ->getValue(); + ->getTarget(); + if (!is_null($parent)) { + return $parent->getValue(); + } + return NULL; } /**