altoslib: Allow for missing product when checking for mma655x inverted
authorKeith Packard <keithp@keithp.com>
Mon, 28 Aug 2017 00:34:07 +0000 (17:34 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 28 Aug 2017 00:40:53 +0000 (17:40 -0700)
If there's no product, assume we've got some ancient log file.

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

index 97a80bcbadb20166cb2774491c7c291f304300be..63c34310f6d12458338d08b2e3a46b8b4cffed06 100644 (file)
@@ -488,14 +488,16 @@ public class AltosConfigData {
 
 
        public boolean mma655x_inverted() throws AltosUnknownProduct {
 
 
        public boolean mma655x_inverted() throws AltosUnknownProduct {
-               if (product.startsWith("EasyMega-v1"))
-                       return false;
-               if (product.startsWith("TeleMetrum-v2"))
-                       return true;
-               if (product.startsWith("TeleMega-v2"))
-                       return false;
-               if (product.startsWith("TeleMega-v1"))
-                       return false;
+               if (product != null) {
+                       if (product.startsWith("EasyMega-v1"))
+                               return false;
+                       if (product.startsWith("TeleMetrum-v2"))
+                               return true;
+                       if (product.startsWith("TeleMega-v2"))
+                               return false;
+                       if (product.startsWith("TeleMega-v1"))
+                               return false;
+               }
                throw new AltosUnknownProduct(product);
        }
 
                throw new AltosUnknownProduct(product);
        }