From 0d68e084b810972ab0bc47d726b21bc886a235fe Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 4 May 2009 12:44:57 +0000 Subject: prevent functions from plugins w/ unopened lua state from being called git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1711 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Lua/src/lua/ULuaCore.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lua/src/lua/ULuaCore.pas b/Lua/src/lua/ULuaCore.pas index 5c6f2463..c5b3a590 100644 --- a/Lua/src/lua/ULuaCore.pas +++ b/Lua/src/lua/ULuaCore.pas @@ -644,6 +644,8 @@ begin Self.ErrorCount := 0; Self.sName := 'not registred'; Self.sStatus := psNone; + + State := nil; //< to prevent calls to unopened state end; destructor TLuaPlugin.Destroy; @@ -753,7 +755,7 @@ end; function TLuaPlugin.CallFunctionByName(Name: String; const nArgs: Integer; const nResults: Integer; const ReportErrors: Boolean): Boolean; begin Result := false; - if not bPaused then + if (not bPaused) and (State <> nil) then begin // we need at least one stack slot free lua_checkstack(State, 1); -- cgit v1.2.3