From fbb7acbc7f59fd79cbe6e59aef21be6d7c6cf5ca Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Wed, 4 Mar 2015 15:20:12 +0100 Subject: 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 --- src/bluetooth/qbluetoothsocket_android.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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("android/bluetooth/BluetoothDevice", "ERROR")) { + == remoteDevice.getStaticField("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; -- cgit v1.2.3