1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-02-06 15:24:55 +08:00

Fix to prevent division by 0 (#251)

This commit is contained in:
Dan Erhardt 2020-04-20 11:56:33 -03:00 committed by GitHub
parent e704b97c77
commit bbdbee90a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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++) {