Skip to content

Commit 1516c07

Browse files
committed
Add null check for BT device in SdlDeviceListener
1 parent bd30aba commit 1516c07

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ public SdlDeviceListener(Context context, BluetoothDevice device, Callback callb
8484
* will listen for 30 seconds, if it is not, this will listen for 15 seconds instead.
8585
*/
8686
public void start() {
87+
if(connectedDevice == null) {
88+
DebugTool.logInfo(TAG + ": No supplied bluetooth device");
89+
if(callback != null){
90+
callback.onTransportError(null);
91+
}
92+
return;
93+
}
94+
8795
if (hasSDLConnected(contextWeakReference.get(), connectedDevice.getAddress())) {
8896
DebugTool.logInfo(TAG + ": Confirmed SDL device, should start router service");
8997
//This device has connected to SDL previously, it is ok to start the RS right now

0 commit comments

Comments
 (0)