summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2018-02-20 14:37:49 +0300
committerKonstantin Ritt <ritt.ks@gmail.com>2019-03-19 10:10:44 +0000
commita61ee48bc16fae61cabb9a242f3a7c19caa4cbfd (patch)
treec1a54633f8ee3476a4acd741ed98d80aa147f314
parent773dfe82221dd6f79c5c465c40f3da9b1283c986 (diff)
LE/Android: add consistency check in method called from Qt API
Call to includedServices() from Qt side after unexpected disconnection leads to NullPointerException due to unchecked member access. Fix that! Change-Id: Iae89801d7af86d5a3f34ebba9eb2ea12da252cd2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java
index dc48514a..6c548f84 100644
--- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java
+++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java
@@ -839,6 +839,9 @@ public class QtBluetoothLE {
*/
public String includedServices(String serviceUuid)
{
+ if (mBluetoothGatt == null)
+ return null;
+
UUID uuid;
try {
uuid = UUID.fromString(serviceUuid);