From 4b6ea54d201040b621bc2d9cdc829b43bf1f1ed5 Mon Sep 17 00:00:00 2001 From: "wubin.xia" Date: Sat, 28 Sep 2019 20:52:44 -0700 Subject: [PATCH] bugfix:angle_compensate_nodes will be out of range if angle >= 359.25 --- src/node.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node.cpp b/src/node.cpp index 4b12ea6b..85175b04 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -334,7 +334,11 @@ int main(int argc, char * argv[]) { int angle_value = (int)(angle * angle_compensate_multiple); if ((angle_value - angle_compensate_offset) < 0) angle_compensate_offset = angle_value; for (j = 0; j < angle_compensate_multiple; j++) { - angle_compensate_nodes[angle_value-angle_compensate_offset+j] = nodes[i]; + + int angle_compensate_nodes_index = angle_value-angle_compensate_offset+j; + if(angle_compensate_nodes_index >= angle_compensate_nodes_count) + angle_compensate_nodes_index = angle_compensate_nodes_count-1; + angle_compensate_nodes[angle_compensate_nodes_index] = nodes[i]; } } }