diff options
-rw-r--r-- | source4/param/pyparam.c | 8 |
1 files changed, 7 insertions, 1 deletions
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])); |