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]; } } }