mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-13 03:07:32 +01:00
Fix rare NPE
This commit is contained in:
parent
3f8620e026
commit
9ed8004a69
@ -207,14 +207,13 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (action.equals(GBDevice.ACTION_DEVICE_CHANGED)) {
|
if (action.equals(GBDevice.ACTION_DEVICE_CHANGED)) {
|
||||||
GBDevice device = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
GBDevice device = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
||||||
// FIXME: mGBDevice was null here once
|
if (mGBDevice != null && mGBDevice.equals(device)) {
|
||||||
if (mGBDevice.equals(device)) {
|
|
||||||
mGBDevice = device;
|
mGBDevice = device;
|
||||||
boolean enableReceivers = mDeviceSupport != null && (mDeviceSupport.useAutoConnect() || mGBDevice.isInitialized());
|
boolean enableReceivers = mDeviceSupport != null && (mDeviceSupport.useAutoConnect() || mGBDevice.isInitialized());
|
||||||
setReceiversEnableState(enableReceivers, mGBDevice.isInitialized(), DeviceHelper.getInstance().getCoordinator(device));
|
setReceiversEnableState(enableReceivers, mGBDevice.isInitialized(), DeviceHelper.getInstance().getCoordinator(device));
|
||||||
GB.updateNotification(mGBDevice.getName() + " " + mGBDevice.getStateString(), mGBDevice.isInitialized(), context);
|
GB.updateNotification(mGBDevice.getName() + " " + mGBDevice.getStateString(), mGBDevice.isInitialized(), context);
|
||||||
} else {
|
} else {
|
||||||
LOG.error("Got ACTION_DEVICE_CHANGED from unexpected device: " + mGBDevice);
|
LOG.error("Got ACTION_DEVICE_CHANGED from unexpected device: " + device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user