From 52decdef82fa132d941aef3901f50bd44825059d Mon Sep 17 00:00:00 2001
From: Alexander Lantsev <aunsane@gmail.com>
Date: Tue, 21 Jul 2015 17:53:42 +0000
Subject: MirLua: fixed crash on script loading

git-svn-id: http://svn.miranda-ng.org/main/trunk@14599 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/MirLua/src/mlua_script.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'plugins/MirLua')

diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp
index aa181a3a22..bbc3fd4355 100644
--- a/plugins/MirLua/src/mlua_script.cpp
+++ b/plugins/MirLua/src/mlua_script.cpp
@@ -61,9 +61,13 @@ bool CMLuaScript::Load()
 
 	lua_pushliteral(L, "Load");
 	lua_gettable(L, -2);
-	if (lua_isfunction(L, -1) && lua_pcall(L, 0, 0, 0))
-		CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)lua_tostring(L, -1));
-	lua_pop(L, 1);
+	if (lua_isfunction(L, -1))
+	{
+		if (lua_pcall(L, 0, 0, 0))
+			CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)lua_tostring(L, -1));
+	}
+	else
+		lua_pop(L, 1);
 
 	lua_pushliteral(L, "Unload");
 	lua_gettable(L, -2);
-- 
cgit v1.2.3