summaryrefslogtreecommitdiff
path: root/codegen/argtypes.py
diff options
context:
space:
mode:
Diffstat (limited to 'codegen/argtypes.py')
-rw-r--r--codegen/argtypes.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/codegen/argtypes.py b/codegen/argtypes.py
index ca1e67c0..0f0dde26 100644
--- a/codegen/argtypes.py
+++ b/codegen/argtypes.py
@@ -417,7 +417,8 @@ class ObjectArg(ArgType):
if ownsreturn:
info.varlist.add('PyObject', '*py_ret')
info.codeafter.append(' py_ret = pygobject_new((GObject *)ret);\n'
- ' g_object_unref(ret);\n'
+ ' if (ret != NULL)\n'
+ ' g_object_unref(ret);\n'
' return py_ret;')
else:
info.codeafter.append(' /* pygobject_new handles NULL checking */\n' +