diff options
Diffstat (limited to 'lib/LuaXML.cc')
-rw-r--r-- | lib/LuaXML.cc | 8 |
1 files changed, 6 insertions, 2 deletions
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[] = { |