Added check that characteristic is not null before reading it. Displays warning on Logcat if it is null rather than crashing.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:versionCode="138"
|
||||
android:versionName="4.2.4a">
|
||||
android:versionName="4.2.4b">
|
||||
<!-- android:allowBackup="false" -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
|
||||
@@ -368,6 +368,7 @@ public class SdDataSourceBLE extends SdDataSource {
|
||||
* @param gattCharacteristic - the characteristic to be read.
|
||||
*/
|
||||
private void executeReadCharacteristic(BluetoothGattCharacteristic gattCharacteristic) {
|
||||
if (gattCharacteristic != null) {
|
||||
boolean retVal = mBluetoothGatt.readCharacteristic(gattCharacteristic);
|
||||
if (retVal) {
|
||||
Log.d(TAG, "executeReadCharacteristic - read initiated successfully");
|
||||
@@ -380,6 +381,9 @@ public class SdDataSourceBLE extends SdDataSource {
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG,"ExecuteReadCharacteristic() - gatCharacteristic is null, so not doing anything");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user