Skip to content

Commit 8238c8f

Browse files
Add additional checks
1 parent 547a907 commit 8238c8f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Dithering
2727
[MethodImpl(InliningOptions.ShortMethod)]
2828
public ErrorDither(in DenseMatrix<float> matrix, int offset)
2929
{
30+
Guard.MustBeGreaterThan(offset, 0, nameof(offset));
31+
3032
this.matrix = matrix;
3133
this.offset = offset;
3234
}

src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Dithering
2424
[MethodImpl(InliningOptions.ShortMethod)]
2525
public OrderedDither(uint length)
2626
{
27+
Guard.MustBeGreaterThan(length, 0, nameof(length));
28+
2729
DenseMatrix<uint> ditherMatrix = OrderedDitherFactory.CreateDitherMatrix(length);
2830

2931
// Create a new matrix to run against, that pre-thresholds the values.

0 commit comments

Comments
 (0)