prevent null pointer exception

This commit is contained in:
Milos Kozak 2017-03-02 20:40:09 +01:00
parent 73fbac1bae
commit d841ff5098
2 changed files with 2 additions and 2 deletions

View file

@ -113,7 +113,7 @@ public class ExecutionService extends Service {
String action = intent.getAction();
if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
log.debug("Device has disconnected " + device.getName());//Device has disconnected
if (mBTDevice != null && mBTDevice.getName().equals(device.getName())) {
if (mBTDevice != null && mBTDevice.getName() != null && mBTDevice.getName().equals(device.getName())) {
if (mSerialIOThread != null) {
mSerialIOThread.disconnect("BT disconnection broadcast");
}

View file

@ -106,7 +106,7 @@ public class ExecutionService extends Service {
String action = intent.getAction();
if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
log.debug("Device has disconnected " + device.getName());//Device has disconnected
if (mBTDevice != null && mBTDevice.getName().equals(device.getName())) {
if (mBTDevice != null && mBTDevice.getName() != null && mBTDevice.getName().equals(device.getName())) {
if (mSerialIOThread != null) {
mSerialIOThread.disconnect("BT disconnection broadcast");
}