add null check
This commit is contained in:
parent
8a081b144a
commit
19ccf91e97
@ -2,12 +2,9 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/BTDemo.iml" filepath="$PROJECT_DIR$/BTDemo.iml" />
|
|
||||||
<module fileurl="file://D:\Project\ble-android-demo\BTDemo.iml" filepath="D:\Project\ble-android-demo\BTDemo.iml" />
|
<module fileurl="file://D:\Project\ble-android-demo\BTDemo.iml" filepath="D:\Project\ble-android-demo\BTDemo.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
<module fileurl="file://D:\Project\ble-android-demo\app\app.iml" filepath="D:\Project\ble-android-demo\app\app.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/ble-android-demo.iml" filepath="$PROJECT_DIR$/ble-android-demo.iml" />
|
<module fileurl="file://$PROJECT_DIR$/ble-android-demo.iml" filepath="$PROJECT_DIR$/ble-android-demo.iml" />
|
||||||
<module fileurl="file://D:\Project\ble-android-demo\ble-android-demo.iml" filepath="D:\Project\ble-android-demo\ble-android-demo.iml" />
|
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -312,7 +312,7 @@ public class PrinterBle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendData(byte[] data) {
|
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 setVal = printerCharacteristic.setValue(data);
|
||||||
boolean sendVal = mBtGatt.writeCharacteristic(printerCharacteristic);
|
boolean sendVal = mBtGatt.writeCharacteristic(printerCharacteristic);
|
||||||
|
Loading…
Reference in New Issue
Block a user