Skip to content

Commit

Permalink
Ignore None type device address when using bdaddr (#1539)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrooggiieerr authored Apr 28, 2024
1 parent 5b44587 commit 514e479
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Fixed
* Fixed mypy requiring ``Unpack[ExtraArgs]`` that were intended to be optional. Fixes #1487.
* Fixed ``KeyError`` in BlueZ ``is_connected()`` and ``get_global_bluez_manager()`` when device is not present. Fixes #1507.
* Fixed BlueZ ``_wait_removed`` completion on invalid object path. Fixes #1489.
* Fixed rare unhandled exception when scanning on macOS when using ``use_bdaddr``. Fixes #1523.

`0.21.1`_ (2023-09-08)
======================
Expand Down
5 changes: 5 additions & 0 deletions bleak/backends/corebluetooth/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ def callback(p: CBPeripheral, a: Dict[str, Any], r: int) -> None:
address_bytes: bytes = (
self._manager.central_manager.retrieveAddressForPeripheral_(p)
)
if address_bytes is None:
logger.debug(
"Could not get Bluetooth address for %s. Ignoring this device.",
p.identifier().UUIDString(),
)
address = address_bytes.hex(":").upper()
else:
address = p.identifier().UUIDString()
Expand Down

0 comments on commit 514e479

Please sign in to comment.