mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 08:18:47 +00:00
fix: validate null arguments for Polygon and PolygonF extensions
This commit is contained in:
parent
5ff521073c
commit
2e9f27b6b7
@ -14,8 +14,14 @@ public static class PolygonExtensions
|
||||
/// </summary>
|
||||
/// <param name="polygon">The polygon whose points to update.</param>
|
||||
/// <param name="point">The point to add.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="polygon" /> is <see langword="null" />.</exception>
|
||||
public static void AddVertex(this Polygon polygon, Vector2Int point)
|
||||
{
|
||||
if (polygon is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(polygon));
|
||||
}
|
||||
|
||||
polygon.AddVertex(point.ToSystemPoint());
|
||||
}
|
||||
|
||||
@ -24,8 +30,23 @@ public static class PolygonExtensions
|
||||
/// </summary>
|
||||
/// <param name="polygon">The polygon whose vertices to update.</param>
|
||||
/// <param name="vertices">The vertices to add.</param>
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// <para><paramref name="polygon" /> is <see langword="null" />.</para>
|
||||
/// -or-
|
||||
/// <para><paramref name="vertices" /> is <see langword="null" />.</para>
|
||||
/// </exception>
|
||||
public static void AddVertices(this Polygon polygon, IEnumerable<Vector2Int> vertices)
|
||||
{
|
||||
if (polygon is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(polygon));
|
||||
}
|
||||
|
||||
if (vertices is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(vertices));
|
||||
}
|
||||
|
||||
foreach (Vector2Int vertex in vertices)
|
||||
{
|
||||
polygon.AddVertex(vertex);
|
||||
|
@ -14,8 +14,14 @@ public static class PolygonFExtensions
|
||||
/// </summary>
|
||||
/// <param name="polygon">The polygon whose vertices to update.</param>
|
||||
/// <param name="vertex">The vertex to add.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="polygon" /> is <see langword="null" />.</exception>
|
||||
public static void AddVertex(this PolygonF polygon, Vector2Int vertex)
|
||||
{
|
||||
if (polygon is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(polygon));
|
||||
}
|
||||
|
||||
polygon.AddVertex(vertex.ToSystemPoint());
|
||||
}
|
||||
|
||||
@ -24,8 +30,14 @@ public static class PolygonFExtensions
|
||||
/// </summary>
|
||||
/// <param name="polygon">The polygon whose vertices to update.</param>
|
||||
/// <param name="vertex">The vertex to add.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="polygon" /> is <see langword="null" />.</exception>
|
||||
public static void AddVertex(this PolygonF polygon, Vector2 vertex)
|
||||
{
|
||||
if (polygon is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(polygon));
|
||||
}
|
||||
|
||||
polygon.AddVertex(vertex.ToSystemPointF());
|
||||
}
|
||||
|
||||
@ -34,8 +46,23 @@ public static class PolygonFExtensions
|
||||
/// </summary>
|
||||
/// <param name="polygon">The polygon whose vertices to update.</param>
|
||||
/// <param name="vertices">The vertices to add.</param>
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// <para><paramref name="polygon" /> is <see langword="null" />.</para>
|
||||
/// -or-
|
||||
/// <para><paramref name="vertices" /> is <see langword="null" />.</para>
|
||||
/// </exception>
|
||||
public static void AddVertices(this PolygonF polygon, IEnumerable<Vector2Int> vertices)
|
||||
{
|
||||
if (polygon is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(polygon));
|
||||
}
|
||||
|
||||
if (vertices is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(vertices));
|
||||
}
|
||||
|
||||
foreach (Vector2Int vertex in vertices)
|
||||
{
|
||||
polygon.AddVertex(vertex);
|
||||
@ -47,8 +74,23 @@ public static class PolygonFExtensions
|
||||
/// </summary>
|
||||
/// <param name="polygon">The polygon whose vertices to update.</param>
|
||||
/// <param name="vertices">The vertices to add.</param>
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// <para><paramref name="polygon" /> is <see langword="null" />.</para>
|
||||
/// -or-
|
||||
/// <para><paramref name="vertices" /> is <see langword="null" />.</para>
|
||||
/// </exception>
|
||||
public static void AddVertices(this PolygonF polygon, IEnumerable<Vector2> vertices)
|
||||
{
|
||||
if (polygon is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(polygon));
|
||||
}
|
||||
|
||||
if (vertices is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(vertices));
|
||||
}
|
||||
|
||||
foreach (Vector2 vertex in vertices)
|
||||
{
|
||||
polygon.AddVertex(vertex);
|
||||
|
Loading…
Reference in New Issue
Block a user