System: Don't crash when dbus isn't installed.

This commit is contained in:
scorpion-26 2023-02-21 11:38:52 +01:00
parent 991864775b
commit 60b9355e88

View file

@ -203,7 +203,12 @@ namespace System
{ {
// Try connecting to d-bus and org.bluez // Try connecting to d-bus and org.bluez
GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, nullptr); GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, nullptr);
ASSERT(connection, "Failed to connect to d-bus!"); if (!connection)
{
LOG("Can't connect to d-bus! Disabling Bluetooth!");
// dbus not found, disable bluetooth
RuntimeConfig::Get().hasBlueZ = false;
}
GError* err = nullptr; GError* err = nullptr;
GVariant* objects = g_dbus_connection_call_sync(connection, "org.bluez", "/", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects", GVariant* objects = g_dbus_connection_call_sync(connection, "org.bluez", "/", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects",