diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-27 22:54:17 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-27 22:54:17 -0700 |
commit | b98f75dbcccd40c8cbf32c3bfd21bd6f5648b861 (patch) | |
tree | ba7cdf3caa5b8ff2202514dd5e78d9803dfbd2bb /altosui/AltosConfigData.java | |
parent | b6c7ae2c1f8cba7351cd139c49322280d9d3af47 (diff) |
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 <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosConfigData.java')
-rw-r--r-- | altosui/AltosConfigData.java | 6 |
1 files changed, 5 insertions, 1 deletions
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<String> { 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+"); |