{"record":{"id":"6f64869c7e717f71","repo":"Unity-Technologies/UnityCsReference","slug":"must-be-greater-than-zero-6f6486","errorCode":null,"errorMessage":"Must be greater than zero","messagePattern":"Must be greater than zero","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Handles/Handles.cs","lineNumber":1818,"sourceCode":"        internal static void ShowSceneViewLabel(Vector3 pos, GUIContent label)\n        {\n            Handles.color = Color.white;\n            Handles.zTest = UnityEngine.Rendering.CompareFunction.Always;\n            GUIStyle style = \"SC ViewAxisLabel\";\n            style.alignment = TextAnchor.MiddleLeft;\n            style.fixedWidth = 0;\n            Handles.BeginGUI();\n            Rect rect = HandleUtility.WorldPointToSizedRect(pos, label, style);\n            rect.x += 10;\n            rect.y += 10;\n            GUI.Label(rect, label, style);\n            Handles.EndGUI();\n        }\n\n        public static Vector3[] MakeBezierPoints(Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent, int division)\n        {\n            if (division < 1)\n                throw new ArgumentOutOfRangeException(\"division\", \"Must be greater than zero\");\n            var points = new Vector3[division];\n            Internal_MakeBezierPoints(points.AsSpan(), startPosition, endPosition, startTangent, endTangent);\n\n            return points;\n        }\n\n        public static void DrawTexture3DSDF(Texture texture,\n            [DefaultValue(\"1.0f\")] float stepScale = 1.0f,\n            [DefaultValue(\"0.0f\")] float surfaceOffset = 0.0f,\n            [DefaultValue(\"null\")] Gradient customColorRamp = null)\n        {\n            Vector3 localScale = new Vector3(matrix.GetColumn(0).magnitude, matrix.GetColumn(1).magnitude, matrix.GetColumn(2).magnitude);\n            Texture3DPreview.PrepareSDFPreview(Texture3DPreview.Materials.SDF, texture, localScale, stepScale, surfaceOffset, customColorRamp);\n            Texture3DPreview.Materials.SDF.SetPass(0);\n            Graphics.DrawMeshNow(cubeMesh, matrix);\n        }\n\n        public static void DrawTexture3DSlice(Texture texture, Vector3 slicePositions,","sourceCodeStart":1800,"sourceCodeEnd":1836,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Handles/Handles.cs#L1800-L1836","documentation":"MakeBezierPoints requires at least one division segment to generate curve sample points. A division of zero or less would allocate an empty or invalid array and produce no geometry. The method allocates Vector3[division] and passes it to the native Internal_MakeBezierPoints, which expects at least one point.","triggerScenarios":"Calling Handles.MakeBezierPoints with division < 1, often from a distance-based or screen-size-based calculation that rounds down to zero when points are very close together.","commonSituations":"Dynamic curve rendering where the division count is computed from screen-space distance; when start and end overlap or are nearly identical the computed division can be zero.","solutions":["Clamp division to a minimum of 1 before calling: Math.Max(1, division).","Add an early-return guard when start and end positions are nearly identical."],"exampleFix":"// before\nvar pts = Handles.MakeBezierPoints(start, end, t1, t2, division);\n// after\nvar pts = Handles.MakeBezierPoints(start, end, t1, t2, Math.Max(1, division));","handlingStrategy":"validation","validationCode":"int safeDivision = Math.Max(1, division);\nvar pts = Handles.MakeBezierPoints(start, end, t1, t2, safeDivision);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always clamp division to at least 1 before calling MakeBezierPoints.","When computing division from screen distance, add an early-return guard for near-zero distances."],"tags":["bezier","math","argument-validation","unity-editor"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}