From: joshuaruesweg Date: Wed, 1 Jul 2020 18:44:14 +0000 (+0200) Subject: Fix revoking trophies w/o conditions yield an SQL error X-Git-Tag: 5.2.8~30 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9f7de7d9621eed562d213927225d731fe2751a9a;p=GitHub%2FWoltLab%2FWCF.git Fix revoking trophies w/o conditions yield an SQL error Fixes #3422 --- diff --git a/wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php b/wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php index c7da8e79cf..c366962c74 100644 --- a/wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php +++ b/wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php @@ -155,6 +155,13 @@ class TrophyConditionHandler extends SingletonFactory { $condition->getObjectType()->getProcessor()->addUserCondition($condition, $pseudoUserList); } + // Check if there are conditions for the award of the trophy for the given trophy. + // If there are no conditions, we simply return an empty list and do not remove any trophy. + // A trophy without conditions that is awarded automatically cannot be created by default. + if (empty($pseudoUserList->getConditionBuilder()->__toString())) { + return []; + } + // Now we create our own query to find out which users no longer meet the conditions. // For this we use a UserList object again and transfer basic data from the pseudo object. $userList = new UserList();