diff --git a/src/ImageSharp/Common/Helpers/Guard.cs b/src/ImageSharp/Common/Helpers/Guard.cs index 0db5cb7c1..e0a4e9bca 100644 --- a/src/ImageSharp/Common/Helpers/Guard.cs +++ b/src/ImageSharp/Common/Helpers/Guard.cs @@ -233,15 +233,33 @@ namespace SixLabors.ImageSharp /// Verifies, that the `target` span has the length of 'minSpan', or longer. /// /// The element type of the spans - /// The target span. + /// The source span. /// The minimum length. /// The name of the parameter that is to be checked. /// - /// is true + /// is true + /// + public static void MustBeSizedAtLeast(ReadOnlySpan source, int minLength, string parameterName) + { + if (source.Length < minLength) + { + throw new ArgumentException($"Span-s must be at least of length {minLength}!", parameterName); + } + } + + /// + /// Verifies, that the `target` span has the length of 'minSpan', or longer. + /// + /// The element type of the spans + /// The target span. + /// The minimum length. + /// The name of the parameter that is to be checked. + /// + /// is true /// - public static void MustBeSizedAtLeast(Span target, int minLength, string parameterName) + public static void MustBeSizedAtLeast(Span dest, int minLength, string parameterName) { - if (target.Length < minLength) + if (dest.Length < minLength) { throw new ArgumentException($"Span-s must be at least of length {minLength}!", parameterName); }