diff --git a/src/Plugin/Condition/EntityHasIdentifier.php b/src/Plugin/Condition/EntityHasIdentifier.php index 8652220..4991d48 100644 --- a/src/Plugin/Condition/EntityHasIdentifier.php +++ b/src/Plugin/Condition/EntityHasIdentifier.php @@ -110,11 +110,13 @@ public function evaluate(): bool { $entity = $this->getContextValue('entity'); if ($entity instanceof FieldableEntityInterface) { $identifier = $this->entityTypeManager->getStorage('dgiactions_identifier')->load($this->configuration['identifier']); - $field = $identifier->get('field'); - $entity_type = $identifier->get('entity'); - $bundle = $identifier->get('bundle'); - if (!empty($field) && $entity->hasField($field) && $entity->getEntityTypeId() == $entity_type && $entity->bundle() == $bundle) { - return !$entity->get($field)->isEmpty(); + if ($identifier) { + $field = $identifier->get('field'); + $entity_type = $identifier->get('entity'); + $bundle = $identifier->get('bundle'); + if (!empty($field) && $entity->hasField($field) && $entity->getEntityTypeId() == $entity_type && $entity->bundle() == $bundle) { + return !$entity->get($field)->isEmpty(); + } } } return FALSE;