From 65de9ac87ca1a61e8bc5ef3d297e5f7d5a9a3e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helmut=20Schottm=C3=BCller?= Date: Fri, 24 Mar 2017 20:15:31 +0100 Subject: [PATCH] Fixed gallery element tags generation if there are not tags defined for a file --- elements/ContentGalleryTags.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; } }