bluez5: don't crash in battery_remove

If device has no adapter, then there's no battery provider.
This commit is contained in:
Pauli Virtanen 2022-01-19 19:42:03 +02:00 committed by Wim Taymans
parent dda65b95af
commit a4b1e4c42a

View file

@ -229,7 +229,7 @@ static void battery_remove(struct spa_bt_device *device) {
device->battery_pending_call = NULL;
}
if (!device->adapter->has_battery_provider || !device->has_battery)
if (!device->adapter || !device->adapter->has_battery_provider || !device->has_battery)
return;
spa_log_debug(device->monitor->log, "Removing virtual battery: %s", device->battery_path);