Skip to content

Commit 9b11c42

Browse files
Merge pull request #49386 from nextcloud/bugfix/47658/dont-fail-precondition-if-unset
fix(userconfig): Don't fail the precondition if the value is not set at all
2 parents 4d85f44 + 394febb commit 9b11c42

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/private/AllConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function setUserValue($userId, $appName, $key, $value, $preCondition = nu
246246
$userPreferences = \OCP\Server::get(IUserConfig::class);
247247
if ($preCondition !== null) {
248248
try {
249-
if ($userPreferences->getValueMixed($userId, $appName, $key) !== (string)$preCondition) {
249+
if ($userPreferences->hasKey($userId, $appName, $key) && $userPreferences->getValueMixed($userId, $appName, $key) !== (string)$preCondition) {
250250
throw new PreConditionNotMetException();
251251
}
252252
} catch (TypeConflictException) {

0 commit comments

Comments
 (0)