summaryrefslogtreecommitdiff
path: root/altosui/AltosConfigUI.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-27 22:54:17 -0700
committerKeith Packard <keithp@keithp.com>2012-03-27 22:54:17 -0700
commitb98f75dbcccd40c8cbf32c3bfd21bd6f5648b861 (patch)
treeba7cdf3caa5b8ff2202514dd5e78d9803dfbd2bb /altosui/AltosConfigUI.java
parentb6c7ae2c1f8cba7351cd139c49322280d9d3af47 (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/AltosConfigUI.java')
-rw-r--r--altosui/AltosConfigUI.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java
index c8ec06d2..879605bc 100644
--- a/altosui/AltosConfigUI.java
+++ b/altosui/AltosConfigUI.java
@@ -708,6 +708,8 @@ public class AltosConfigUI
}
public void set_ignite_mode(int new_ignite_mode) {
+ if (new_ignite_mode >= ignite_mode_values.length)
+ new_ignite_mode = 0;
if (new_ignite_mode < 0) {
ignite_mode_value.setEnabled(false);
new_ignite_mode = 0;
@@ -727,6 +729,8 @@ public class AltosConfigUI
public void set_pad_orientation(int new_pad_orientation) {
+ if (new_pad_orientation >= pad_orientation_values.length)
+ new_pad_orientation = 0;
if (new_pad_orientation < 0) {
pad_orientation_value.setEnabled(false);
new_pad_orientation = 0;