Fix segfaults in spline UI

I suspect that this actually started happening when Python upgrades
happened, since the previous logic was checking for zero-length
trajectories, but it looks like numpy may now manage zero-length arrays
differently than it did previousl.

Change-Id: Id4212d0c7ea6efcf47295841c92de3aad79072a5
diff --git a/frc971/control_loops/python/graph.py b/frc971/control_loops/python/graph.py
index 5f68444..3063bd1 100644
--- a/frc971/control_loops/python/graph.py
+++ b/frc971/control_loops/python/graph.py
@@ -43,7 +43,7 @@
             mypoints.addConstraintsToTrajectory(traj)
             traj.Plan()
             XVA = traj.GetPlanXVA(dT)
-            if len(XVA[0]) > 0:
+            if XVA is not None:
                 self.draw_x_axis(cr, start, height, zero, XVA, end)
                 self.drawVelocity(cr, XVA, start, height, skip, zero, end,
                                   legend_entries)
diff --git a/frc971/control_loops/python/libspline.py b/frc971/control_loops/python/libspline.py
index 4e68221..9ba6f4f 100755
--- a/frc971/control_loops/python/libspline.py
+++ b/frc971/control_loops/python/libspline.py
@@ -251,6 +251,9 @@
             libSpline.TrajectoryGetPlanXVAPtr(self.__trajectory,
                                               int(dt * 1e9)))
         XVALength = libSpline.TrajectoryGetVectorLength(XVAPtr)
+        if XVALength == 0:
+            libSpline.TrajectoryDeleteVector(XVAPtr)
+            return None
         X = np.zeros(XVALength)
         V = np.zeros(XVALength)
         A = np.zeros(XVALength)