altosui: Handle missing pad distance in descent tab
authorKeith Packard <keithp@keithp.com>
Wed, 17 Oct 2012 00:13:04 +0000 (17:13 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 17 Oct 2012 00:13:04 +0000 (17:13 -0700)
When the GPS isn't locked, the distance from the pad cannot be
computed and is left missing. Not crashing in this case is more useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosDescent.java

index e9ff590b735e6d79dbec25187ad421426bd9f8f0..a71cdc10c0fc97f2305951365294cc165f1d3580 100644 (file)
@@ -309,7 +309,10 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
 
        class Distance extends DescentValue {
                void show(AltosState state, int crc_errors) {
-                       show(AltosConvert.distance, state.from_pad.distance);
+                       if (state.from_pad != null)
+                               show(AltosConvert.distance, state.from_pad.distance);
+                       else
+                               show("???");
                }
 
                public Distance (GridBagLayout layout, int x, int y) {