From a301b76458be0828013972ef16da8103ce79440c Mon Sep 17 00:00:00 2001 From: Stefan Scheu Date: Fri, 9 Jun 2023 09:24:07 +0200 Subject: [PATCH] fix: check if asset id exists before creating a hotspot image --- models/DataObject/ClassDefinition/Data/Hotspotimage.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/DataObject/ClassDefinition/Data/Hotspotimage.php b/models/DataObject/ClassDefinition/Data/Hotspotimage.php index d8b567df4b5..c20d877c571 100644 --- a/models/DataObject/ClassDefinition/Data/Hotspotimage.php +++ b/models/DataObject/ClassDefinition/Data/Hotspotimage.php @@ -327,7 +327,10 @@ public function getDataFromEditmode($data, $object = null, $params = []) $data['hotspots'] = $rewritePath($data['hotspots']); } - return new DataObject\Data\Hotspotimage($data['id'] ?? null, $data['hotspots'] ?? [], $data['marker'] ?? [], $data['crop'] ?? []); + if ($data && isset($data['id']) && (int)$data['id'] > 0) { + return new DataObject\Data\Hotspotimage($data['id'], $data['hotspots'] ?? [], $data['marker'] ?? [], $data['crop'] ?? []); + } + return null; } /**