aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-10-03 11:48:45 +0000
committerbloodstalker <thabogre@gmail.com>2018-10-03 11:48:45 +0000
commit919391929752a2e8d38228a29c6fe7c8bc9586e1 (patch)
tree51c1eaef90f97a4fe4b0cdce4be3f947739724d3
parentfix (diff)
downloadluatablegen-919391929752a2e8d38228a29c6fe7c8bc9586e1.tar.gz
luatablegen-919391929752a2e8d38228a29c6fe7c8bc9586e1.zip
fix
-rwxr-xr-xluatablegen.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/luatablegen.py b/luatablegen.py
index 559a8c5..8fe0228 100755
--- a/luatablegen.py
+++ b/luatablegen.py
@@ -718,7 +718,9 @@ class TbgParser(object):
dummy = "lua_checkstack(__ls, 3);\nlua_newtable(__ls);\n"
dummy += "for (uint64_t i = 0; i < dummy->" + count_replacer + " ; ++i) {\nlua_pushinteger(__ls, i+1);\n"
if ref_node_type != None:
- dummy += ref_node_type.attrib["name"]+ "_push_args(__ls, dummy->"+field_name+"[i]);\nnew_" + ref_node_type.attrib["name"] + "(__ls);\n"
+ dummy += "if (dummy->" +field_name+ "[i] != NULL) {\n"
+ dummy += ref_node_type.attrib["name"]+ "_push_args(__ls, dummy->"+field_name+"[i]);\n"+"} else {\nlua_pop(__ls, 1);\n break;\n}"
+ dummy += "new_" + ref_node_type.attrib["name"] + "(__ls);\n"
else:
eq_lua_type = get_eq_lua_type(field_type)
dummy += "lua_push"+eq_lua_type+"(__ls, dummy->"+field_name+"[i]);\n"