Skip to content

Commit 1738d9d

Browse files
committed
Use Gurad for checking null paths
1 parent 1c773be commit 1738d9d

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

src/ImageSharp.Drawing/Shapes/PolygonClipper/Clipper.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ public IPath[] GenerateClippedShapes()
9090
/// <exception cref="ClipperException">AddPath: Open paths have been disabled</exception>
9191
public void AddPaths(ClippablePath[] paths)
9292
{
93-
if (paths == null)
94-
{
95-
throw new ArgumentNullException(nameof(paths));
96-
}
93+
Guard.NotNull(paths, nameof(paths));
9794

9895
for (int i = 0; i < paths.Length; i++)
9996
{
@@ -111,10 +108,7 @@ public void AddPaths(ClippablePath[] paths)
111108
/// <exception cref="ClipperException">AddPath: Open paths have been disabled </exception>
112109
public void AddPaths(IEnumerable<IPath> paths, ClippingType clippingType)
113110
{
114-
if (paths is null)
115-
{
116-
throw new ArgumentNullException(nameof(paths));
117-
}
111+
Guard.NotNull(paths, nameof(paths));
118112

119113
foreach (IPath p in paths)
120114
{
@@ -130,10 +124,7 @@ public void AddPaths(IEnumerable<IPath> paths, ClippingType clippingType)
130124
/// <exception cref="ClipperException">AddPath: Open paths have been disabled </exception>
131125
public void AddPath(IPath path, ClippingType clippingType)
132126
{
133-
if (path is null)
134-
{
135-
throw new ArgumentNullException(nameof(path));
136-
}
127+
Guard.NotNull(path, nameof(path));
137128

138129
foreach (ISimplePath p in path.Flatten())
139130
{

src/ImageSharp.Drawing/Shapes/PolygonClipper/ClipperOffset.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ public void AddPath(ReadOnlySpan<PointF> pathPoints, JointStyle jointStyle, EndC
7575
/// <exception cref="ClipperException">AddPath: Invalid Path</exception>
7676
public void AddPath(IPath path, JointStyle jointStyle, EndCapStyle endCapStyle)
7777
{
78-
if (path is null)
79-
{
80-
throw new ArgumentNullException(nameof(path));
81-
}
78+
Guard.NotNull(path, nameof(path));
8279

8380
foreach (ISimplePath p in path.Flatten())
8481
{

0 commit comments

Comments
 (0)