From b98f75dbcccd40c8cbf32c3bfd21bd6f5648b861 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 27 Mar 2012 22:54:17 -0700 Subject: altosui: Sanity check values from device configuration If someone has down-graded and re up-graded the firmware, the config entries may be garbage. Sanity check them to avoid crashing the UI. Signed-off-by: Keith Packard --- altosui/AltosConfigData.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'altosui/AltosConfigData.java') diff --git a/altosui/AltosConfigData.java b/altosui/AltosConfigData.java index 0608b4d3..53509dfa 100644 --- a/altosui/AltosConfigData.java +++ b/altosui/AltosConfigData.java @@ -156,7 +156,11 @@ public class AltosConfigData implements Iterable { try { apogee_delay = get_int(line, "Apogee delay:"); } catch (Exception e) {} try { radio_channel = get_int(line, "Radio channel:"); } catch (Exception e) {} try { radio_setting = get_int(line, "Radio setting:"); } catch (Exception e) {} - try { radio_frequency = get_int(line, "Frequency:"); } catch (Exception e) {} + try { + radio_frequency = get_int(line, "Frequency:"); + if (radio_frequency < 0) + radio_frequency = 434550; + } catch (Exception e) {} try { if (line.startsWith("Accel cal")) { String[] bits = line.split("\\s+"); -- cgit v1.2.3