Fix segmentation fault in spline ui
Segfault was caused by not checking if a list is empty
when passing it to a function that used ffi. Fixed
by checking if the list is empty. When someone had
a spline and they pressed add multispline it would
segfault.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I1d17ab61b8610852631c2d020b8c14503651a34f
diff --git a/frc971/control_loops/python/multispline.py b/frc971/control_loops/python/multispline.py
index 5551587..830cfde 100644
--- a/frc971/control_loops/python/multispline.py
+++ b/frc971/control_loops/python/multispline.py
@@ -264,6 +264,8 @@
best_multispline = None
for multispline_index, multispline in enumerate(multisplines):
+ if not multispline.getLibsplines():
+ continue
distance_spline = DistanceSpline(multispline.getLibsplines())
# The optimizer finds local minima that often aren't what we want,