altoslib: Check for empty gps height series
authorKeith Packard <keithp@keithp.com>
Sun, 28 May 2017 21:42:30 +0000 (14:42 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 28 May 2017 21:42:30 +0000 (14:42 -0700)
When the gps height series is present but empty, there won't be a max value.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosFlightStats.java

index 1d020a9d132a0ca911e7c9f6487e5d72903de9dd..8a50f4b5512662585e28dd2cf5739f4b151508ab 100644 (file)
@@ -254,8 +254,10 @@ public class AltosFlightStats {
                                max_acceleration = tv.value;
                }
                max_gps_height = AltosLib.MISSING;
-               if (series.gps_height != null)
-                       max_gps_height = series.gps_height.max().value;
-
+               if (series.gps_height != null) {
+                       AltosTimeValue tv = series.gps_height.max();
+                       if (tv != null)
+                               max_gps_height = tv.value;
+               }
        }
 }