diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-03-04 15:20:12 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-03-05 07:15:23 +0000 |
commit | fbb7acbc7f59fd79cbe6e59aef21be6d7c6cf5ca (patch) | |
tree | 0437d0dbe90543922c2bb8a215fe6008a2a41fda /src | |
parent | dbf0bd93096f8ef54ebcf550ff104237742778dd (diff) |
Fix case where BluetoothDevice.getServiceChannel() error is not handled
This applies to Android versions 4.1.x and below. The function returns
BluetoothDevice.ERROR or -1 in case of an error. So far only the ERROR
case was caught.
Task-number: QTBUG-44792
Change-Id: I512f846d74f2a03b2e6f5bf4df4127d584993f6c
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/qbluetoothsocket_android.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp index c8216ea2..73968e05 100644 --- a/src/bluetooth/qbluetoothsocket_android.cpp +++ b/src/bluetooth/qbluetoothsocket_android.cpp @@ -138,7 +138,8 @@ bool QBluetoothSocketPrivate::fallBackConnect(QAndroidJniObject uuid, int channe } if (socketChannel - == remoteDevice.getStaticField<jint>("android/bluetooth/BluetoothDevice", "ERROR")) { + == remoteDevice.getStaticField<jint>("android/bluetooth/BluetoothDevice", "ERROR") + || socketChannel == -1) { qCWarning(QT_BT_ANDROID) << "Cannot determine RFCOMM service channel."; } else { qCWarning(QT_BT_ANDROID) << "Using found rfcomm channel" << socketChannel; |