Browse Source

change: handle null userData in FromUserData method

Akeit0 6 months ago
parent
commit
b494732802
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Lua/LuaValue.cs

+ 2 - 1
src/Lua/LuaValue.cs

@@ -416,8 +416,9 @@ public readonly struct LuaValue : IEquatable<LuaValue>
         };
         };
     }
     }
 
 
-    public static LuaValue FromUserData(ILuaUserData userData)
+    public static LuaValue FromUserData(ILuaUserData? userData)
     {
     {
+        if (userData is null) return Nil;
         return new(userData);
         return new(userData);
     }
     }