From a4b1e4c42aa7737c4ee03033e9a50c209249a207 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Wed, 19 Jan 2022 19:42:03 +0200 Subject: [PATCH] bluez5: don't crash in battery_remove If device has no adapter, then there's no battery provider. --- spa/plugins/bluez5/bluez5-dbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 3e8ea4c6b..f04f5ba1a 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -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);