From d139c681f13d3b0d0d2316ad73e76b6b2be0f1c3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 11 Jul 2014 17:03:27 +0200 Subject: [PATCH] Add check on NULL pointer before calling *_get_user_data in the Python wrapper. --- tools/python/apixml2python/linphone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python/apixml2python/linphone.py b/tools/python/apixml2python/linphone.py index fab665461..c9821d34b 100644 --- a/tools/python/apixml2python/linphone.py +++ b/tools/python/apixml2python/linphone.py @@ -155,7 +155,7 @@ class MethodDefinition: stripped_return_type = strip_leading_linphone(self.return_type) if self.class_['class_has_user_data']: get_user_data_function = self.__find_class_definition(self.return_type)['class_c_function_prefix'] + "get_user_data" - self.body += "\tif (" + get_user_data_function + "(cresult) != NULL) {\n" + self.body += "\tif ((cresult != NULL) && (" + get_user_data_function + "(cresult) != NULL)) {\n" self.body += "\t\treturn (PyObject *)" + get_user_data_function + "(cresult);\n" self.body += "\t}\n" self.body += "\tpyresult = pylinphone_" + stripped_return_type + "_new_from_native_ptr(&pylinphone_" + stripped_return_type + "Type, cresult);\n"