diff --git a/src/MembershipManager.php b/src/MembershipManager.php index a8a87e5f1..a6ac1730a 100644 --- a/src/MembershipManager.php +++ b/src/MembershipManager.php @@ -167,6 +167,12 @@ public function getGroupIds(EntityInterface $entity, $group_type_id = NULL, $gro continue; } + $values = $entity->get($field->getName())->getValue(); + if (empty($values[0])) { + // Entity doesn't reference any groups. + continue; + } + // Compile a list of group target IDs. $target_ids = array_map(function ($value) { return $value['target_id'];