Skip to content

Commit

Permalink
Merge pull request #50493 from nextcloud/backport/47889/stable30
Browse files Browse the repository at this point in the history
[stable30] fix: `user:settings` command when user is not available
  • Loading branch information
skjnldsv authored Jan 28, 2025
2 parents f262fdf + 48a13be commit 1a8175e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/Command/User/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}

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

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

return $settings;
}
Expand Down

0 comments on commit 1a8175e

Please sign in to comment.