https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/c2f31bb550755acba31da2e9f5bbdf646ed5e805

From c2f31bb550755acba31da2e9f5bbdf646ed5e805 Mon Sep 17 00:00:00 2001
From: Julian Bouzas <julian.bouzas@collabora.com>
Date: Mon, 16 May 2022 15:41:10 -0400
Subject: [PATCH] m-lua-scripting: allow converting GValue holding NULL objects
 to Lua

---
 modules/module-lua-scripting/wplua/value.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/module-lua-scripting/wplua/value.c b/modules/module-lua-scripting/wplua/value.c
index 133051a4..e31ae4ac 100644
--- a/modules/module-lua-scripting/wplua/value.c
+++ b/modules/module-lua-scripting/wplua/value.c
@@ -314,9 +314,14 @@ wplua_gvalue_to_lua (lua_State *L, const GValue *v)
       wplua_pushboxed (L, G_VALUE_TYPE (v), g_value_dup_boxed (v));
     break;
   case G_TYPE_OBJECT:
-  case G_TYPE_INTERFACE:
-    wplua_pushobject (L, g_value_dup_object (v));
+  case G_TYPE_INTERFACE: {
+    GObject *object = g_value_dup_object (v);
+    if (object)
+      wplua_pushobject (L, g_value_dup_object (v));
+    else
+      lua_pushnil (L);
     break;
+  }
   case G_TYPE_ENUM:
     wplua_enum_to_lua (L, g_value_get_enum (v), G_VALUE_TYPE (v));
     break;
-- 
GitLab

