Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit dec2c12

Browse files
committed
Fix potential NullReferenceException.
ArgumentNotEmptyString should handle null value being passed in.
1 parent 58bc0a8 commit dec2c12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/GitHub.Extensions/Guard.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ public static void ArgumentNonNegative(int value, string name)
3737
}
3838

3939
/// <summary>
40-
/// Checks a string argument to ensure it isn't null or empty.
40+
/// Checks a string argument to ensure it isn't null or empty.
4141
/// </summary>
4242
/// <param name = "value">The argument value to check.</param>
4343
/// <param name = "name">The name of the argument.</param>
4444
public static void ArgumentNotEmptyString(string value, string name)
4545
{
46-
if (value.Length > 0) return;
46+
if (value?.Length > 0) return;
4747
string message = String.Format(CultureInfo.InvariantCulture, "The value for '{0}' must not be empty", name);
4848
#if DEBUG
4949
if (!InUnitTestRunner())

0 commit comments

Comments
 (0)