Fix IndexError when cursor_index > data[0].size in spline UI
Change-Id: I95a2a6141648b8028208c55cb4b02f33e9c2a9de
Signed-off-by: Ryan Yin <100028731@mvla.net>
diff --git a/frc971/control_loops/python/path_edit.py b/frc971/control_loops/python/path_edit.py
index b66a668..c1b4fcf 100755
--- a/frc971/control_loops/python/path_edit.py
+++ b/frc971/control_loops/python/path_edit.py
@@ -233,8 +233,11 @@
multispline, result = Multispline.nearest_distance(
self.multisplines, mouse)
- if self.graph.cursor is not None and self.graph.data is not None:
- multispline_index, x = self.graph.find_cursor()
+ if self.graph.cursor is not None:
+ cursor = self.graph.find_cursor()
+ if cursor is None:
+ return
+ multispline_index, x = cursor
distance_spline = DistanceSpline(
self.multisplines[multispline_index].getLibsplines())