From 528532bd14777c7b6a1dbff7c740df2c866a77a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B9=B3?= Date: Mon, 9 Jan 2017 17:44:15 +0800 Subject: [PATCH] Fixed : call debug.getmetatable maybe cause NullReferenceException --- src/MoonSharp.Interpreter/CoreLib/DebugModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MoonSharp.Interpreter/CoreLib/DebugModule.cs b/src/MoonSharp.Interpreter/CoreLib/DebugModule.cs index c61d30ba..44c9e29b 100644 --- a/src/MoonSharp.Interpreter/CoreLib/DebugModule.cs +++ b/src/MoonSharp.Interpreter/CoreLib/DebugModule.cs @@ -84,7 +84,7 @@ public static DynValue getmetatable(ScriptExecutionContext executionContext, Cal if (v.Type.CanHaveTypeMetatables()) return DynValue.NewTable(S.GetTypeMetatable(v.Type)); - else if (v.Type == DataType.Table) + else if (v.Type == DataType.Table && v.Table.MetaTable != null) return DynValue.NewTable(v.Table.MetaTable); else return DynValue.Nil;