fix(bot): crash in 'pk;ap' command when system has no switches registered

This commit is contained in:
spiral 2022-06-27 05:42:23 -04:00
parent 42fb75c3a4
commit 07936ec561
No known key found for this signature in database
GPG Key ID: 244A11E4B0BCF40E

View File

@ -90,7 +90,7 @@ public class Autoproxy
.Title($"Current autoproxy status (for {ctx.Guild.Name.EscapeMarkdown()})"); .Title($"Current autoproxy status (for {ctx.Guild.Name.EscapeMarkdown()})");
var sw = await ctx.Repository.GetLatestSwitch(ctx.System.Id); var sw = await ctx.Repository.GetLatestSwitch(ctx.System.Id);
var fronters = await ctx.Database.Execute(c => ctx.Repository.GetSwitchMembers(c, sw.Id)).ToListAsync(); var fronters = sw == null ? new() : await ctx.Database.Execute(c => ctx.Repository.GetSwitchMembers(c, sw.Id)).ToListAsync();
var relevantMember = settings.AutoproxyMode switch var relevantMember = settings.AutoproxyMode switch
{ {