Skip to content

Commit

Permalink
Fix invalid input to foreach (#3724)
Browse files Browse the repository at this point in the history
* Fix invalid input to foreach

This happens with discord oauth, possibly others

* Update UserGroupObject.php

---------

Co-authored-by: Andy Miller <[email protected]>
  • Loading branch information
ricardo118 and rhukster authored Oct 24, 2023
1 parent db3e39f commit 382a836
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function authorize(string $action, string $scope = null): ?bool
public static function groupNames(): array
{
$groups = [];
$user_groups = Grav::instance()['user_groups'];
$user_groups = Grav::instance()['user_groups'] ?? [];

foreach ($user_groups as $key => $group) {
$groups[$key] = $group->readableName;
Expand Down

0 comments on commit 382a836

Please sign in to comment.