diff --git a/elements/ContentGalleryTags.php b/elements/ContentGalleryTags.php index fd050f1..e259d98 100644 --- a/elements/ContentGalleryTags.php +++ b/elements/ContentGalleryTags.php @@ -92,11 +92,14 @@ public static function addImageToTemplate($objTemplate, $arrItem, $intMaxWidth=n { $found = \TagModel::findByIdAndTable($arrItem['id'], 'tl_files'); $tags = array(); - while ($found->next()) + if ($found && $found->count()) { - array_push($tags, $found->tag); + while ($found->next()) + { + array_push($tags, $found->tag); + } + $objTemplate->tags = $tags; } - $objTemplate->tags = $tags; } }