From ef9cb19d8b210e02eaa1c657833c1bd5fc619ad8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 16 Oct 2012 17:13:04 -0700 Subject: [PATCH] altosui: Handle missing pad distance in descent tab 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 --- altosui/AltosDescent.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java index e9ff590b..a71cdc10 100644 --- a/altosui/AltosDescent.java +++ b/altosui/AltosDescent.java @@ -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) { -- 2.30.2