From 084df88624e94bbdd2bb052053e96a7cdd599e36 Mon Sep 17 00:00:00 2001 From: rladenson <78043712+rladenson@users.noreply.github.com> Date: Sun, 30 Jul 2023 00:02:51 -0600 Subject: [PATCH] fix(bot): don't try to get system guild settings while not in a guild (#576) --- PluralKit.Bot/Commands/SystemFront.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PluralKit.Bot/Commands/SystemFront.cs b/PluralKit.Bot/Commands/SystemFront.cs index 6c4e093e..08fdf18c 100644 --- a/PluralKit.Bot/Commands/SystemFront.cs +++ b/PluralKit.Bot/Commands/SystemFront.cs @@ -134,10 +134,12 @@ public class SystemFront if (rangeStart.Value.ToInstant() > now) throw Errors.FrontPercentTimeInFuture; var title = new StringBuilder("Frontpercent of "); - var guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, system.Id); + SystemGuildSettings guildSettings = null; + if (ctx.Guild != null) + guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, system.Id); if (group != null) title.Append($"{group.NameFor(ctx)} (`{group.Hid}`)"); - else if (guildSettings.DisplayName != null) + else if (ctx.Guild != null && guildSettings.DisplayName != null) title.Append($"{guildSettings.DisplayName} (`{system.Hid}`)"); else if (system.NameFor(ctx) != null) title.Append($"{system.NameFor(ctx)} (`{system.Hid}`)");