1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-19 10:03:58 +03:00

Bong! The devmode could be NULL. Don't crash if this is the case.

This commit is contained in:
Tim Potter -
parent c7845b3c43
commit 3ce8f8c50c

View File

@ -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));