From c333001750bf29cb34c5b52abd9572563943c1e5 Mon Sep 17 00:00:00 2001 From: pixel Date: Mon, 2 Apr 2007 23:35:08 +0000 Subject: Consolidating the Lua-XML parser a bit more. --- lib/LuaXML.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/LuaXML.cc b/lib/LuaXML.cc index 93a3fb7..4f9c6ba 100644 --- a/lib/LuaXML.cc +++ b/lib/LuaXML.cc @@ -74,6 +74,7 @@ static int LuaXML_ParseString(lua_State *L) { doc.Parse(xml_string); lua_newtable(L); LuaXML_ParseNode(L, &doc); + return 1; } #define XMLBUFSIZ 81920 @@ -87,12 +88,15 @@ static int LuaXML_ParseHandle(lua_State *__L) { while (!h->IsClosed()) { l = h->read(buffer, XMLBUFSIZ); - buffer[l] = 0; - doc.Parse(buffer); + if (l) { + buffer[l] = 0; + doc.Parse(buffer); + } } lua_newtable(__L); LuaXML_ParseNode(__L, &doc); + return 1; } static const luaL_reg xmllib[] = { -- cgit v1.2.3