Skip to content

Commit f752a01

Browse files
Merge pull request #50492 from nextcloud/backport/47889/stable31
[stable31] fix: `user:settings` command when user is not available
2 parents fe352bf + 00286ee commit f752a01

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/Command/User/Setting.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
219219
}
220220
}
221221

222-
protected function getUserSettings($uid, $app) {
222+
protected function getUserSettings(string $uid, string $app): array {
223223
$settings = $this->config->getAllUserValues($uid);
224224
if ($app !== '') {
225225
if (isset($settings[$app])) {
@@ -230,7 +230,10 @@ protected function getUserSettings($uid, $app) {
230230
}
231231

232232
$user = $this->userManager->get($uid);
233-
$settings['settings']['display_name'] = $user->getDisplayName();
233+
if ($user !== null) {
234+
// Only add the display name if the user exists
235+
$settings['settings']['display_name'] = $user->getDisplayName();
236+
}
234237

235238
return $settings;
236239
}

0 commit comments

Comments
 (0)