From bd8f7f15a0551aff2a3cd84b7447217cf76cd396 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Tue, 10 Apr 2018 17:10:39 -0400 Subject: [PATCH] refactor: validation --- ICD.Common.Utils/Extensions/EventHandlerExtensions.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs b/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs index 958cf38..cb812b7 100644 --- a/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs +++ b/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs @@ -14,6 +14,9 @@ namespace ICD.Common.Utils.Extensions /// public static void Raise(this EventHandler extends, object sender) { + if (sender == null) + throw new ArgumentNullException("sender"); + if (extends != null) extends(sender, EventArgs.Empty); } @@ -28,6 +31,12 @@ namespace ICD.Common.Utils.Extensions public static void Raise(this EventHandler extends, object sender, T args) where T : EventArgs { + if (sender == null) + throw new ArgumentNullException("sender"); + + if (args == null) + throw new ArgumentNullException("args"); + if (extends != null) extends(sender, args); }