From de29a591d2572f912bec450c009ca316ea008413 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Fri, 8 Feb 2019 12:36:16 -0800 Subject: [PATCH] add null or whitespace check --- src/Discord.Net.Webhook/DiscordWebhookClient.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Discord.Net.Webhook/DiscordWebhookClient.cs b/src/Discord.Net.Webhook/DiscordWebhookClient.cs index 2a0de5ef7..33da596e5 100644 --- a/src/Discord.Net.Webhook/DiscordWebhookClient.cs +++ b/src/Discord.Net.Webhook/DiscordWebhookClient.cs @@ -56,8 +56,13 @@ namespace Discord.Webhook /// The url of the webhook. /// The configuration options to use for this client. /// Thrown if the is an invalid format. + /// Thrown if the is null or whitespace. public DiscordWebhookClient(string webhookUrl, DiscordRestConfig config) : this(config) { + if (string.IsNullOrWhiteSpace(webhookUrl)) + throw new ArgumentNullException(paramName: nameof(webhookUrl), message: + "The given webhook Url cannot be null or whitespace."); + // thrown when groups are not populated/valid, or when there is no match ArgumentException ex() => new ArgumentException(paramName: nameof(webhookUrl), message: "The given webhook Url was not in a valid format.");