From d1d06bf7ad2f0c02165f17904d219fc535477f25 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 Aug 2017 11:15:11 +0200 Subject: winrt: Fix crash in QBluetoothServer::nextPendingConnection If there are no pending connections, the call should not make the application crash but just return nullptr. Change-Id: I33c2ec9b47bbb72abc99ad22035f794724b295ef Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothserver_winrt.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bluetooth/qbluetoothserver_winrt.cpp b/src/bluetooth/qbluetoothserver_winrt.cpp index 61134c1f..ddd71c21 100644 --- a/src/bluetooth/qbluetoothserver_winrt.cpp +++ b/src/bluetooth/qbluetoothserver_winrt.cpp @@ -217,6 +217,8 @@ bool QBluetoothServer::hasPendingConnections() const QBluetoothSocket *QBluetoothServer::nextPendingConnection() { Q_D(QBluetoothServer); + if (d->pendingConnections.count() == 0) + return nullptr; ComPtr socket = d->pendingConnections.takeFirst(); -- cgit v1.2.3