From 31278377cd572588d48a7e26debf220ac07db0cc Mon Sep 17 00:00:00 2001 From: quin lynch Date: Fri, 28 May 2021 07:28:12 -0300 Subject: [PATCH] Fix null ex --- .../API/Common/ButtonComponent.cs | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/Discord.Net.Rest/API/Common/ButtonComponent.cs b/src/Discord.Net.Rest/API/Common/ButtonComponent.cs index 3c8fcca8c..dd10bcd44 100644 --- a/src/Discord.Net.Rest/API/Common/ButtonComponent.cs +++ b/src/Discord.Net.Rest/API/Common/ButtonComponent.cs @@ -42,23 +42,25 @@ namespace Discord.API this.Url = c.Url; this.Disabled = c.Disabled; - if (c.Emote is Emote e) + if (c.Emote != null) { - this.Emote = new Emoji() + if (c.Emote is Emote e) { - Name = e.Name, - Animated = e.Animated, - Id = e.Id, - }; - } - else - { - this.Emote = new Emoji() + this.Emote = new Emoji() + { + Name = e.Name, + Animated = e.Animated, + Id = e.Id, + }; + } + else { - Name = c.Emote.Name - }; - } - + this.Emote = new Emoji() + { + Name = c.Emote.Name + }; + } + } } } }