From ceaa254d7a4d56429da783bd3ab1da8036a81ed0 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 2 Apr 2023 03:12:04 +0100 Subject: [PATCH] docs/perf: throw for null input --- X10D.Unity/src/DebugUtility/DebugUtility.Polygon.cs | 6 ++++++ X10D.Unity/src/DebugUtility/DebugUtility.Polyhedron.cs | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/X10D.Unity/src/DebugUtility/DebugUtility.Polygon.cs b/X10D.Unity/src/DebugUtility/DebugUtility.Polygon.cs index f12088c..1e0fa9f 100644 --- a/X10D.Unity/src/DebugUtility/DebugUtility.Polygon.cs +++ b/X10D.Unity/src/DebugUtility/DebugUtility.Polygon.cs @@ -206,8 +206,14 @@ public static partial class DebugUtility /// if depth test should be applied; otherwise, . Passing /// will have the box be obscured by objects closer to the camera. /// + /// is . public static void DrawPolygon(PolygonF polygon, in Vector3 offset, in Color color, float duration, bool depthTest) { + if (polygon is null) + { + throw new ArgumentNullException(nameof(polygon)); + } + IReadOnlyList points = polygon.Vertices; if (points.Count < 2) { diff --git a/X10D.Unity/src/DebugUtility/DebugUtility.Polyhedron.cs b/X10D.Unity/src/DebugUtility/DebugUtility.Polyhedron.cs index 510dbf2..7ab51a0 100644 --- a/X10D.Unity/src/DebugUtility/DebugUtility.Polyhedron.cs +++ b/X10D.Unity/src/DebugUtility/DebugUtility.Polyhedron.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using X10D.Drawing; using X10D.Unity.Numerics; @@ -103,8 +103,14 @@ public static partial class DebugUtility /// if depth test should be applied; otherwise, . Passing /// will have the box be obscured by objects closer to the camera. /// + /// is . public static void DrawPolyhedron(Polyhedron polyhedron, in Vector3 offset, in Color color, float duration, bool depthTest) { + if (polyhedron is null) + { + throw new ArgumentNullException(nameof(polyhedron)); + } + IReadOnlyList points = polyhedron.Vertices; if (points.Count < 2) {