Windows: fix a potential crash in FromBluetoothAddressAsync


According to MS docs, the function can return a NULL device if the
device is not paired or is not found in the system cache.

According to the linked Jira ticket, such behavior can be triggered in
practice if the device uses a Resolvable Private Address, and the
address changes between the scan and the attempt to connect.

Fix it by explicitly checking the obtained result for nullptr, and
returning an error in case it is.

We use FromBluetoothAddressAsync in several other places, but all of
them already implement this check, so the only affected place is the
service discovery agent.

Fixes: QTBUG-146756
Pick-to: 6.11 6.8
Change-Id: I5d55acfc9cda57fcce80b44feaac15f6553c8350
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
commita4a5fcf0f01d505da7225d8651d3bad4762d27fc
parentf7c9cc108ada9f2d2309837551471b44963d4fe7
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeMon, 18 May 2026 09:14:48 +0000