From 370f2d96f4d22e0f794b33d608f3dcbc7538aa70 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 27 Jun 2021 13:14:11 +0100 Subject: [PATCH] (#42) Validate not-null value --- X10D/src/ComparableExtensions/ComparableExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/X10D/src/ComparableExtensions/ComparableExtensions.cs b/X10D/src/ComparableExtensions/ComparableExtensions.cs index b1e0b49..a38de3b 100644 --- a/X10D/src/ComparableExtensions/ComparableExtensions.cs +++ b/X10D/src/ComparableExtensions/ComparableExtensions.cs @@ -46,6 +46,11 @@ namespace X10D public static bool Between(this T1 value, T2 lower, T3 upper) where T1 : IComparable, IComparable { + if (value is null) + { + throw new ArgumentNullException(nameof(value)); + } + return value.CompareTo(lower) > 0 && value.CompareTo(upper) < 0; }