summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorPaul Pogonyshev <pogonyshev@gmx.net>2008-12-03 19:45:41 +0000
committerPaul Pogonyshev <paulp@src.gnome.org>2008-12-03 19:45:41 +0000
commit95886775af564a05aaaf5708f0b37279f82d0d76 (patch)
treea71042cb7a18fb42f814e0dbc7b0271e3acfdc96 /glib
parente857558ac6c8557b27e204d09917eff7eecdbddb (diff)
downloadpygobject-95886775af564a05aaaf5708f0b37279f82d0d76.tar.gz
pygobject-95886775af564a05aaaf5708f0b37279f82d0d76.tar.xz
pygobject-95886775af564a05aaaf5708f0b37279f82d0d76.zip
Test if `domain' is not-null before using it (avoids segfaults, see bug
2008-12-03 Paul Pogonyshev <pogonyshev@gmx.net> * glib/pyglib.c (pyglib_error_check): Test if `domain' is not-null before using it (avoids segfaults, see bug #561826). svn path=/trunk/; revision=976
Diffstat (limited to 'glib')
-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));