diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua index be4648ef..8d297c19 100644 --- a/src/scripts/monitors/alsa.lua +++ b/src/scripts/monitors/alsa.lua @@ -177,9 +177,13 @@ end function createDevice(parent, id, factory, properties) local device = SpaDevice(factory, properties) - device:connect("create-object", createNode) - device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND) - parent:store_managed_object(id, device) + if device then + device:connect("create-object", createNode) + device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND) + parent:store_managed_object(id, device) + else + Log.warning ("Failed to create '" .. factory .. "' device") + end end function prepareDevice(parent, id, type, factory, properties) diff --git a/src/scripts/monitors/bluez.lua b/src/scripts/monitors/bluez.lua index 172e013d..4a54a7b2 100644 --- a/src/scripts/monitors/bluez.lua +++ b/src/scripts/monitors/bluez.lua @@ -109,8 +109,13 @@ function createDevice(parent, id, type, factory, properties) -- create the device device = SpaDevice(factory, properties) - device:connect("create-object", createNode) - parent:store_managed_object(id, device) + if device then + device:connect("create-object", createNode) + parent:store_managed_object(id, device) + else + Log.warning ("Failed to create '" .. factory .. "' device") + return + end end Log.info(parent, string.format("%d, %s (%s): %s", diff --git a/src/scripts/monitors/libcamera.lua b/src/scripts/monitors/libcamera.lua index e6e3ed95..27c74597 100644 --- a/src/scripts/monitors/libcamera.lua +++ b/src/scripts/monitors/libcamera.lua @@ -125,9 +125,13 @@ function createDevice(parent, id, type, factory, properties) -- create the device local device = SpaDevice(factory, properties) - device:connect("create-object", createNode) - device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND) - parent:store_managed_object(id, device) + if device then + device:connect("create-object", createNode) + device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND) + parent:store_managed_object(id, device) + else + Log.warning ("Failed to create '" .. factory .. "' device") + end end monitor = SpaDevice("api.libcamera.enum.manager", config.properties or {}) diff --git a/src/scripts/monitors/v4l2.lua b/src/scripts/monitors/v4l2.lua index fd9a20db..102eb810 100644 --- a/src/scripts/monitors/v4l2.lua +++ b/src/scripts/monitors/v4l2.lua @@ -125,9 +125,13 @@ function createDevice(parent, id, type, factory, properties) -- create the device local device = SpaDevice(factory, properties) - device:connect("create-object", createNode) - device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND) - parent:store_managed_object(id, device) + if device then + device:connect("create-object", createNode) + device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND) + parent:store_managed_object(id, device) + else + Log.warning ("Failed to create '" .. factory .. "' device") + end end monitor = SpaDevice("api.v4l2.enum.udev", config.properties or {})