1
0
mirror of synced 2026-04-25 20:02:10 +00:00

throw exception when member is NULL

This commit is contained in:
Benedikt Tutzer
2018-12-06 12:17:09 +01:00
parent 5c59429893
commit 6577a69246

View File

@@ -1676,6 +1676,9 @@ class WMember:
def gen_def(self):
text = "\n\t" + self.wtype.gen_text() + " " + self.member_of.name +"::get_var_py_" + self.name + "()"
text += "\n\t{\n\t\t"
if self.wtype.attr_type == attr_types.star:
text += "if(this->get_cpp_obj()->" + self.name + " == NULL)\n\t\t\t"
text += "throw std::runtime_error(\"Member \\\"" + self.name + "\\\" is NULL\");\n\t\t"
if self.wtype.name in known_containers:
text += self.wtype.gen_text_cpp()
else: