Skip to content

Commit e4e9dae

Browse files
authoredJan 28, 2025··
Merge pull request #47889 from nextcloud/fix/settings-command
fix: `user:settings` command when user is not available
2 parents 0180e8c + 5867231 commit e4e9dae

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)
Please sign in to comment.