mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
Xiaomi: Prevent NPE when not yet connected
This commit is contained in:
parent
ce1d095074
commit
81ca617601
@ -428,6 +428,12 @@ public abstract class XiaomiSupport extends AbstractBTLEDeviceSupport {
|
||||
}
|
||||
|
||||
public void sendCommand(final TransactionBuilder builder, final XiaomiProto.Command command) {
|
||||
if (this.characteristicCommandWrite == null) {
|
||||
// Can sometimes happen in race conditions when connecting + receiving calendar event or weather updates
|
||||
LOG.warn("characteristicCommandWrite is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME builder is ignored
|
||||
final byte[] commandBytes = command.toByteArray();
|
||||
LOG.debug("Sending command {}", GB.hexdump(commandBytes));
|
||||
@ -435,6 +441,12 @@ public abstract class XiaomiSupport extends AbstractBTLEDeviceSupport {
|
||||
}
|
||||
|
||||
public void sendCommand(final TransactionBuilder builder, final byte[] commandBytes) {
|
||||
if (this.characteristicCommandWrite == null) {
|
||||
// Can sometimes happen in race conditions when connecting + receiving calendar event or weather updates
|
||||
LOG.warn("characteristicCommandWrite is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME builder is ignored
|
||||
this.characteristicCommandWrite.write(commandBytes);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user