altosdroid: Show our position in the map tab. Squeeze to fit phones
[fw/altos] / altosdroid / src / org / altusmetrum / AltosDroid / TelemetryService.java
index 0ddfdfc3ad50c6ed281cac7a05b5910dd43546a7..f1304a95298f3d645e10eb13419e90ba9d993a07 100644 (file)
@@ -245,6 +245,9 @@ public class TelemetryService extends Service {
        }
 
        private void startAltosBluetooth() {
+               if (device == null) {
+                       return;
+               }
                if (mAltosBluetooth == null) {
                        if (D) Log.d(TAG, String.format("startAltosBluetooth(): Connecting to %s (%s)", device.getName(), device.getAddress()));
                        mAltosBluetooth = new AltosBluetooth(device, mHandler);
@@ -274,6 +277,8 @@ public class TelemetryService extends Service {
 
        private void connected() {
                try {
+                       if (mAltosBluetooth == null)
+                               throw new InterruptedException("no bluetooth");
                        mConfigData = mAltosBluetooth.config_data();
                } catch (InterruptedException e) {
                } catch (TimeoutException e) {