From 293817582647ae5e196b3ffc56314eeca999cee2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20Fr=C3=BChwirt?= Date: Sat, 7 Dec 2019 17:26:35 +0100 Subject: [PATCH] Fix LabelFormField for objects without labels LabelHandler will return an empty array if no label was attached to an object, which will result in undefined offset error in the LabelFormField --- .../system/form/builder/field/label/LabelFormField.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/label/LabelFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/label/LabelFormField.class.php index ce3d6476a7..8d83511939 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/label/LabelFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/label/LabelFormField.class.php @@ -105,10 +105,11 @@ class LabelFormField extends AbstractFormField implements IObjectTypeFormNode { static::$loadedLabels[$objectTypeID] = []; } if (!isset(static::$loadedLabels[$objectTypeID][$objectID])) { - static::$loadedLabels[$objectTypeID][$objectID] = LabelHandler::getInstance()->getAssignedLabels( + $assignedLabels = LabelHandler::getInstance()->getAssignedLabels( $objectTypeID, [$objectID] - )[$objectID]; + ); + static::$loadedLabels[$objectTypeID][$objectID] = isset($assignedLabels[$objectID]) ? $assignedLabels[$objectID] : []; } $labelIDs = $this->getLabelGroup()->getLabelIDs(); -- 2.20.1