summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-09-19 05:39:03 +0000
committerTim Potter <tpot@samba.org>2002-09-19 05:39:03 +0000
commit86c7c460ca6c099f3593a092581ee5364179e481 (patch)
tree80ebf9e1af6744f3f5d5abff18a08f3353568789
parenta39dcb606dff72c2b851e692224b8ec1140e093c (diff)
downloadsamba-86c7c460ca6c099f3593a092581ee5364179e481.tar.gz
samba-86c7c460ca6c099f3593a092581ee5364179e481.tar.bz2
samba-86c7c460ca6c099f3593a092581ee5364179e481.zip
Bong! The devmode could be NULL. Don't crash if this is the case.
(This used to be commit 3ce8f8c50c0adcedc38bf2812b7e9fae78942458)
-rw-r--r--source3/python/py_spoolss_printers_conv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/python/py_spoolss_printers_conv.c b/source3/python/py_spoolss_printers_conv.c
index 247db65b1e..760896fcde 100644
--- a/source3/python/py_spoolss_printers_conv.c
+++ b/source3/python/py_spoolss_printers_conv.c
@@ -227,8 +227,14 @@ BOOL py_from_PRINTER_INFO_2(PyObject **dict, PRINTER_INFO_2 *info)
if (py_from_SECDESC(&obj, info->secdesc))
PyDict_SetItemString(*dict, "security_descriptor", obj);
- if (py_from_DEVICEMODE(&obj, info->devmode))
- PyDict_SetItemString(*dict, "device_mode", obj);
+ /* Bong! The devmode could be NULL */
+
+ if (info->devmode)
+ py_from_DEVICEMODE(&obj, info->devmode);
+ else
+ obj = PyDict_New();
+
+ PyDict_SetItemString(*dict, "device_mode", obj);
PyDict_SetItemString(*dict, "level", PyInt_FromLong(2));