aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Tutzer <e1225461@student.tuwien.ac.at>2018-12-06 12:17:09 +0100
committerBenedikt Tutzer <e1225461@student.tuwien.ac.at>2018-12-06 12:17:09 +0100
commit6577a6924665f54c6db8f12cda5b089247516981 (patch)
tree6c947aba4a0b85ba230a484a5e8286a20ebe0cb3
parent5c59429893b24ff539c65172066a6f343d3dc28e (diff)
downloadyosys-6577a6924665f54c6db8f12cda5b089247516981.tar.gz
yosys-6577a6924665f54c6db8f12cda5b089247516981.tar.bz2
yosys-6577a6924665f54c6db8f12cda5b089247516981.zip
throw exception when member is NULL
-rw-r--r--py_wrap_generator.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/py_wrap_generator.py b/py_wrap_generator.py
index 40b4ddc17..658779ca6 100644
--- a/py_wrap_generator.py
+++ b/py_wrap_generator.py
@@ -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: