diff --git a/src/ImageSharp/Color/Color.cs b/src/ImageSharp/Color/Color.cs index ad271dbf9b..fcf091638e 100644 --- a/src/ImageSharp/Color/Color.cs +++ b/src/ImageSharp/Color/Color.cs @@ -152,6 +152,8 @@ namespace SixLabors.ImageSharp /// public static Color Parse(string input) { + Guard.NotNull(input, nameof(input)); + if (!TryParse(input, out Color color)) { throw new ArgumentException("Input string is not in the correct format.", nameof(input)); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs index 1449cb0301..62f8d97e8f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs @@ -243,6 +243,8 @@ namespace SixLabors.ImageSharp.PixelFormats [MethodImpl(InliningOptions.ShortMethod)] public static Rgba32 ParseHex(string hex) { + Guard.NotNull(hex, nameof(hex)); + if (!TryParseHex(hex, out Rgba32 rgba)) { throw new ArgumentException("Hexadecimal string is not in the correct format.", nameof(hex));