Check the existance of the opts dict before accessing it

This commit is contained in:
Davide Andreoli 2014-08-30 17:54:00 +02:00
parent ea66f6dbc2
commit fd5637b089
1 changed files with 2 additions and 1 deletions

View File

@ -266,7 +266,8 @@ edgar_gadget_load(const char *name, const char *path)
gadget->edjefile = NULL;
// read the gadget options dict
if ((opts = PyObject_GetAttrString(mod, "__gadget_opts__")))
if (PyObject_HasAttrString(mod, "__gadget_opts__") &&
(opts = PyObject_GetAttrString(mod, "__gadget_opts__")))
{
attr = PyDict_GetItemString(opts, "popup_on_desktop");
if (attr && PyObject_IsTrue(attr))