diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index d9df44a09..633d151b6 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -272,7 +272,7 @@ namespace ImageSharp.Formats /// is less than or equals than zero. private static Span ToArrayByBitsLength(Span source, int bytesPerScanline, int bits) { - Guard.NotNull(source, nameof(source)); + Guard.MustBeGreaterThan(source.Length, 0, nameof(source)); Guard.MustBeGreaterThan(bits, 0, nameof(bits)); if (bits >= 8)