From 662ad18586c8a813a6ae3c1f50aaf932b1462cef Mon Sep 17 00:00:00 2001 From: Christopher F Date: Sun, 23 Apr 2017 14:29:30 -0400 Subject: [PATCH] Don't allow EmbedBuilder's Fields to be set to null --- .../Entities/Messages/EmbedBuilder.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs b/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs index ab1ebdf37..98a191379 100644 --- a/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs +++ b/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs @@ -24,7 +24,16 @@ namespace Discord public EmbedAuthorBuilder Author { get; set; } public EmbedFooterBuilder Footer { get; set; } - public List Fields { get; set; } + private List _fields; + public List Fields + { + get => _fields; + set + { + if (value != null) _fields = value; + else throw new ArgumentNullException("Cannot set an embed builder's fields collection to null", nameof(value)); + } + } public EmbedBuilder WithTitle(string title) {