Browse Source

Resolve unexpected crash due to lua string

Emagi 11 months ago
parent
commit
09978db335
1 changed files with 4 additions and 4 deletions
  1. 4 4
      EQ2/source/WorldServer/LuaInterface.cpp

+ 4 - 4
EQ2/source/WorldServer/LuaInterface.cpp

@@ -1713,7 +1713,7 @@ Quest* LuaInterface::GetQuest(lua_State* state, int8 arg_num) {
 	if(lua_islightuserdata(state, arg_num)){
 		LUAUserData* data = (LUAUserData*)lua_touserdata(state, arg_num);
 		if(!data || !data->IsCorrectlyInitialized()){
-			LogError("%s: GetQuest error while processing %s", GetScriptName(state), lua_tostring(state, 0));
+			LogError("%s: GetQuest error while processing %s", GetScriptName(state), lua_tostring(state, -1));
 		}
 		else if(!data->IsQuest()){
 			lua_Debug ar;
@@ -1733,7 +1733,7 @@ Item* LuaInterface::GetItem(lua_State* state, int8 arg_num) {
 	if(lua_islightuserdata(state, arg_num)){
 		LUAUserData* data = (LUAUserData*)lua_touserdata(state, arg_num);
 		if(!data || !data->IsCorrectlyInitialized()){
-			LogError("%s: GetItem error while processing %s", GetScriptName(state), lua_tostring(state, 0));
+			LogError("%s: GetItem error while processing %s", GetScriptName(state), lua_tostring(state, -1));
 		}
 		else if(!data->IsItem()){
 			lua_Debug ar;
@@ -1753,7 +1753,7 @@ Skill* LuaInterface::GetSkill(lua_State* state, int8 arg_num) {
 	if (lua_islightuserdata(state, arg_num)) {
 		LUAUserData* data = (LUAUserData*)lua_touserdata(state, arg_num);
 		if (!data || !data->IsCorrectlyInitialized()) {
-			LogError("%s: GetSkill error while processing %s", GetScriptName(state), lua_tostring(state, 0));
+			LogError("%s: GetSkill error while processing %s", GetScriptName(state), lua_tostring(state, -1));
 		}
 		else if (!data->IsSkill()) {
 			lua_Debug ar;
@@ -1773,7 +1773,7 @@ LuaSpell* LuaInterface::GetSpell(lua_State* state, int8 arg_num) {
 	if (lua_islightuserdata(state, arg_num)) {
 		LUAUserData* data = (LUAUserData*)lua_touserdata(state, arg_num);
 		if (!data || !data->IsCorrectlyInitialized()) {
-			LogError("%s: GetSpell error while processing %s", GetScriptName(state), lua_tostring(state, 0));
+			LogError("%s: GetSpell error while processing %s", GetScriptName(state), lua_tostring(state, -1));
 		}
 		else if (!data->IsSpell()) {
 			lua_Debug ar;