add null check
This commit is contained in:
@@ -312,7 +312,7 @@ public class PrinterBle {
|
||||
}
|
||||
|
||||
private void sendData(byte[] data) {
|
||||
if (data == null || data.length < 1 || data.length > 20) return;
|
||||
if (data == null || data.length < 1 || data.length > 20 || printerCharacteristic == null) return;
|
||||
|
||||
boolean setVal = printerCharacteristic.setValue(data);
|
||||
boolean sendVal = mBtGatt.writeCharacteristic(printerCharacteristic);
|
||||
|
||||
Reference in New Issue
Block a user