Skip to content

Commit

Permalink
Fix crash when no permission overrides are present in a guild (#155)
Browse files Browse the repository at this point in the history
* Fix crash when no permissions overides are found in guild

* Run dart format

---------

Co-authored-by: Mylo Fawcett <mylo.fawcett@gmail.com>
  • Loading branch information
olimarmite and abitofevrything authored Sep 19, 2024
1 parent 6ec6b77 commit 55a6397
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/checks/permissions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ class PermissionsCheck extends Check {
if (overrides.permissions.isEmpty) {
overrides =
(await context.client.guilds[context.guild!.id].commands.listPermissions())
.singleWhere((overrides) => overrides.command == null);
.singleWhere(
(overrides) => overrides.command == null,
orElse: () => overrides,
);
}

bool? def;
Expand Down

0 comments on commit 55a6397

Please sign in to comment.