Do not fail if groups don't exist

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-05-07 13:54:44 +02:00
parent f9fff3a165
commit 4d4c2257a0

View File

@@ -103,12 +103,15 @@ class ConfigController extends Controller {
$groups = array_map(function($groupId) { $groups = array_map(function($groupId) {
/** @var IGroup $groups */ /** @var IGroup $groups */
$group = $this->groupManager->get($groupId); $group = $this->groupManager->get($groupId);
if ($group === null) {
return null;
}
return [ return [
'id' => $group->getGID(), 'id' => $group->getGID(),
'displayname' => $group->getDisplayName(), 'displayname' => $group->getDisplayName(),
]; ];
}, $groups); }, $groups);
return $groups; return array_filter($groups);
} }
} }