From 6577a6924665f54c6db8f12cda5b089247516981 Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Thu, 6 Dec 2018 12:17:09 +0100 Subject: [PATCH] throw exception when member is NULL --- py_wrap_generator.py | 3 +++ 1 file changed, 3 insertions(+) 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: -- 2.30.2