summaryrefslogtreecommitdiffstats
path: root/glib/pyglib.c
diff options
context:
space:
mode:
Diffstat (limited to 'glib/pyglib.c')
-rw-r--r--glib/pyglib.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/glib/pyglib.c b/glib/pyglib.c
index 4dabb19..4001708 100644
--- a/glib/pyglib.c
+++ b/glib/pyglib.c
@@ -270,9 +270,14 @@ pyglib_error_check(GError **error)
}
exc_instance = PyObject_CallFunction(exc_type, "z", (*error)->message);
- PyObject_SetAttrString(exc_instance, "domain",
- d=_PyUnicode_FromString(g_quark_to_string((*error)->domain)));
- Py_DECREF(d);
+
+ if ((*error)->domain) {
+ PyObject_SetAttrString(exc_instance, "domain",
+ d=_PyUnicode_FromString(g_quark_to_string((*error)->domain)));
+ Py_DECREF(d);
+ }
+ else
+ PyObject_SetAttrString(exc_instance, "domain", Py_None);
PyObject_SetAttrString(exc_instance, "code",
d=_PyLong_FromLong((*error)->code));