diff --git a/.idea/modules.xml b/.idea/modules.xml index cf4f13d..a822a05 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,12 +2,9 @@ - - - \ No newline at end of file diff --git a/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java b/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java index 93f5cba..9719e9d 100644 --- a/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java +++ b/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java @@ -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);