diff --git a/inc/targetbase.class.php b/inc/targetbase.class.php index 0a3129157..2e94e7f15 100644 --- a/inc/targetbase.class.php +++ b/inc/targetbase.class.php @@ -315,6 +315,10 @@ protected function setTargetEntity($data, PluginFormcreatorFormAnswer $formanswe foreach ($res_entities as $entity) { $data_entities[] = $entity; } + if (count($data_entities) < 1) { + // No entity found + return $entityId; + } $first_entity = array_shift($data_entities); $entityId = $first_entity[$entityFk]; break;