From 30a91fceef6b0f9fcddc9a9bc06c2f96731ffa4c Mon Sep 17 00:00:00 2001 From: Dan Erhardt <51964473+DanErhardt@users.noreply.github.com> Date: Mon, 20 Apr 2020 11:49:01 -0300 Subject: [PATCH] Fix to prevent division by 0 --- 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++) {