Skip to content

Commit 7658620

Browse files
committed
Implement requested change
1 parent 47461c9 commit 7658620

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

Shared/mods/deathmatch/logic/luadefs/CLuaXMLDefs.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -223,25 +223,23 @@ int CLuaXMLDefs::xmlLoadString(lua_State* luaVM)
223223
CScriptArgReader argStream(luaVM);
224224
argStream.ReadString(strXmlContent);
225225

226-
if (!argStream.HasErrors())
226+
if (argStream.HasErrors())
227+
return luaL_error(luaVM, argStream.GetFullErrorMessage());
228+
229+
// Grab our resource
230+
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
231+
if (pLuaMain)
227232
{
228-
// Grab our resource
229-
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
230-
if (pLuaMain)
231-
{
232-
CXMLNode* rootNode = pLuaMain->ParseString(strXmlContent);
233+
CXMLNode* rootNode = pLuaMain->ParseString(strXmlContent);
233234

234-
if (rootNode && rootNode->IsValid())
235-
{
236-
lua_pushxmlnode(luaVM, rootNode);
237-
return 1;
238-
}
239-
else
240-
m_pScriptDebugging->LogCustom(luaVM, "Unable to load XML string");
235+
if (rootNode && rootNode->IsValid())
236+
{
237+
lua_pushxmlnode(luaVM, rootNode);
238+
return 1;
241239
}
240+
else
241+
m_pScriptDebugging->LogCustom(luaVM, "Unable to load XML string");
242242
}
243-
else
244-
return luaL_error(luaVM, argStream.GetFullErrorMessage());
245243

246244
lua_pushboolean(luaVM, false);
247245
return 1;

0 commit comments

Comments
 (0)