diff --git a/pathauto.module b/pathauto.module index 38a15d6..55f5782 100644 --- a/pathauto.module +++ b/pathauto.module @@ -99,7 +99,9 @@ function pathauto_entity_update(EntityInterface $entity) { function pathauto_entity_delete(EntityInterface $entity) { if ($entity->hasLinkTemplate('canonical') && $entity instanceof ContentEntityInterface && $entity->hasField('path') && $entity->getFieldDefinition('path')->getType() == 'path') { \Drupal::service('pathauto.alias_storage_helper')->deleteEntityPathAll($entity); - if ($item = $entity->get('path')->first()) { + $item = $entity->get('path')->first(); + + if ($item instanceof PathautoItem && $item->__isset('pathauto')) { $item->get('pathauto')->purge(); } }