altoslib: Protect has_monitor_battery from unset product
authorKeith Packard <keithp@keithp.com>
Wed, 19 May 2021 17:52:47 +0000 (10:52 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 19 May 2021 17:53:45 +0000 (10:53 -0700)
AltosDroid can query has_monitor_battery before the product data has
been set.

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

index 7b78f760cbf43646fd5923f2fbce0aa7a695a0f6..b6105f92fc3cb27265e087fb530d84da2f2f79e8 100644 (file)
@@ -223,6 +223,8 @@ public class AltosConfigData {
        }
 
        public boolean has_monitor_battery() {
+               if (product == null)
+                       return false;
                if (product.startsWith("TeleBT"))
                        return true;
                return false;