altosui: Don't deref null pyros when saving altimeter config
authorKeith Packard <keithp@keithp.com>
Thu, 28 Mar 2013 05:11:53 +0000 (22:11 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 28 Mar 2013 05:11:53 +0000 (22:11 -0700)
The check for no pyro config is to compare npyros against zero rather
than check the length of the pyros array as the latter may be null.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosConfigData.java

index 12659d88100322bffdca273180047356951551fa..45b95646dabfd4ab7687a67973544135d49ed0f5 100644 (file)
@@ -476,7 +476,7 @@ public class AltosConfigData implements Iterable<String> {
                /* UI doesn't support AES key config */
 
                /* AO_PYRO_NUM */
-               if (pyros.length > 0) {
+               if (npyro > 0) {
                        for (int p = 0; p < pyros.length; p++) {
                                link.printf("c P %s\n",
                                                   pyros[p].toString());