From a48a19d9db855973f7f0d89ca0759fd7f6856f55 Mon Sep 17 00:00:00 2001
From: Alex Blasche <alexander.blasche@qt.io>
Date: Tue, 25 Sep 2018 11:02:52 +0200
Subject: [PATCH] Don't trigger passkey pairing notification if remote device
 is unknown

The device address is essential for proper processing of
pairingDisplayConfirmation() signal on Android. If it is not available
abort immediately. This brings the passkey pairing code in line with
pincode pairing.

Change-Id: I174a2478d48463c58ba937e71ced377d45892f1a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
---
 src/bluetooth/android/localdevicebroadcastreceiver.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/bluetooth/android/localdevicebroadcastreceiver.cpp b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
index 2d247574..e3b01987 100644
--- a/src/bluetooth/android/localdevicebroadcastreceiver.cpp
+++ b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
@@ -244,6 +244,9 @@ void LocalDeviceBroadcastReceiver::onReceive(JNIEnv *env, jobject context, jobje
                                                   "(Ljava/lang/String;)Landroid/os/Parcelable;",
                                                   keyExtra.object<jstring>());
 
+            if (!bluetoothDevice.isValid())
+                return;
+
             //we need to keep a reference around in case the user confirms later on
             pairingDevice = bluetoothDevice;
 
-- 
GitLab