summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-04-25 05:27:35 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2013-04-25 05:27:35 -0700
commit61663928259f6f48c11f6e43334a62dd2b3eb8e6 (patch)
tree0f687e8e494e16324cd116050e0f52f9b1529afa
parent0dff1940caf52ea5f1de27cc801ea6d4dab3a446 (diff)
downloadpygobject-61663928259f6f48c11f6e43334a62dd2b3eb8e6.tar.gz
Test results of g_base_info_get_name for NULL
Block against potential NULL result when generating type hint with _g_arg_get_pytype_hint. https://bugzilla.gnome.org/show_bug.cgi?id=698829
-rw-r--r--gi/pygi-info.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 097f4390..1229d784 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -431,11 +431,19 @@ _g_arg_get_pytype_hint (PyGIBaseInfo *self)
} else {
Py_DecRef(py_type);
if (type_tag == GI_TYPE_TAG_INTERFACE) {
+ const char *info_name;
+ PyObject *py_string;
GIBaseInfo *iface = g_type_info_get_interface(&type_info);
+
+ info_name = g_base_info_get_name (iface);
+ if (info_name == NULL) {
+ g_base_info_unref (iface);
+ return PYGLIB_PyUnicode_FromString(g_type_tag_to_string(type_tag));
+ }
+
gchar *name = g_strdup_printf("%s.%s",
g_base_info_get_namespace(iface),
- g_base_info_get_name (iface));
- PyObject *py_string;
+ info_name);
g_base_info_unref(iface);
py_string = PYGLIB_PyUnicode_FromString(name);
g_free(name);