From 86c7c460ca6c099f3593a092581ee5364179e481 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 19 Sep 2002 05:39:03 +0000 Subject: Bong! The devmode could be NULL. Don't crash if this is the case. (This used to be commit 3ce8f8c50c0adcedc38bf2812b7e9fae78942458) --- source3/python/py_spoolss_printers_conv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3') 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)); -- cgit