From: Ricardo Jorge Date: Mon, 3 Aug 2009 22:03:04 +0000 (+0200) Subject: param/pyparam: Cope with string list parameters being empty. X-Git-Tag: talloc-2.0.0~486 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3641978dfa88398dbc494845fe611dd87f2317b7;p=thirdparty%2Fsamba.git param/pyparam: Cope with string list parameters being empty. Signed-off-by: Jelmer Vernooij --- diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index 37e882e1cc8..58799f8d37f 100644 --- a/source4/param/pyparam.c +++ b/source4/param/pyparam.c @@ -129,7 +129,13 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha { int j; const char **strlist = *(const char ***)parm_ptr; - PyObject *pylist = PyList_New(str_list_length(strlist)); + PyObject *pylist; + + if(strlist == NULL) { + return PyList_New(0); + } + + pylist = PyList_New(str_list_length(strlist)); for (j = 0; strlist[j]; j++) PyList_SetItem(pylist, j, PyString_FromString(strlist[j]));