python/param: Cope with lp configfile being NULL.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 15 Jan 2009 20:16:31 +0000 (21:16 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 15 Jan 2009 20:16:31 +0000 (21:16 +0100)
source4/param/pyparam.c

index 2d5a584fb2709656573de95464e83b022ecd959d..0061eadc54e0c98f85aa1122de87accad499fe6a 100644 (file)
@@ -263,7 +263,11 @@ static PyObject *py_lp_ctx_default_service(py_talloc_Object *self, void *closure
 
 static PyObject *py_lp_ctx_config_file(py_talloc_Object *self, void *closure)
 {
 
 static PyObject *py_lp_ctx_config_file(py_talloc_Object *self, void *closure)
 {
-       return PyString_FromString(lp_configfile(self->ptr));
+       const char *configfile = lp_configfile(self->ptr);
+       if (configfile == NULL)
+               Py_RETURN_NONE;
+       else
+               return PyString_FromString(configfile);
 }
 
 static PyGetSetDef py_lp_ctx_getset[] = {
 }
 
 static PyGetSetDef py_lp_ctx_getset[] = {