From d0891fbdcc13a61836462525edab776366f86a24 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 6 Feb 2020 23:21:02 -0800 Subject: [PATCH] altosdroid: Check if the telem service is running when bluetooth gets enabled Make sure we aren't trying to send a message when the telem service is shut down and the pointer is null. Signed-off-by: Keith Packard --- .../java/org/altusmetrum/AltosDroid/AltosDroid.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java index 88168289..155b8069 100644 --- a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java @@ -959,10 +959,12 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener, } private void bluetoothEnabled(Intent data) { - try { - mService.send(Message.obtain(null, TelemetryService.MSG_BLUETOOTH_ENABLED, null)); - } catch (RemoteException e) { - AltosDebug.debug("send BT enabled message failed"); + if (mService != null) { + try { + mService.send(Message.obtain(null, TelemetryService.MSG_BLUETOOTH_ENABLED, null)); + } catch (RemoteException e) { + AltosDebug.debug("send BT enabled message failed"); + } } } -- 2.30.2