From 3641978dfa88398dbc494845fe611dd87f2317b7 Mon Sep 17 00:00:00 2001 From: Ricardo Jorge Date: Tue, 4 Aug 2009 00:03:04 +0200 Subject: param/pyparam: Cope with string list parameters being empty. Signed-off-by: Jelmer Vernooij --- source4/param/pyparam.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source4/param') diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index 37e882e1cc..58799f8d37 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])); -- cgit