From bbdbee90a169778d1a8a4b45f2362ec7c6817479 Mon Sep 17 00:00:00 2001 From: Dan Erhardt <51964473+DanErhardt@users.noreply.github.com> Date: Mon, 20 Apr 2020 11:56:33 -0300 Subject: [PATCH] Fix to prevent division by 0 (#251) --- Scripts/Editor/NodeEditorGUI.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs index 236091c..7c82a12 100755 --- a/Scripts/Editor/NodeEditorGUI.cs +++ b/Scripts/Editor/NodeEditorGUI.cs @@ -202,6 +202,7 @@ namespace XNodeEditor { Vector2 prev_point = point_a; // Approximately one segment per 5 pixels int segments = (int) Vector2.Distance(point_a, point_b) / 5; + segments = Math.Max(segments, 1); int draw = 0; for (int j = 0; j <= segments; j++) { @@ -285,6 +286,7 @@ namespace XNodeEditor { Vector2 prev_point = point_a; // Approximately one segment per 5 pixels int segments = (int) Vector2.Distance(point_a, point_b) / 5; + segments = Math.Max(segments, 1); int draw = 0; for (int j = 0; j <= segments; j++) {