Fix segfault calling `id_properties_ui("prop").update()`
Fix segfault when calling `some_id.id_properties_ui("propname").update()`, i.e. call the `update()` function without any keyword arguments. In such a case, Python passes `kwargs = NULL`, but `PyDict_Contains()` is not `NULL`-safe.
This commit is contained in:
parent
1236d2aea8
commit
e0fd31f083
|
@ -49,6 +49,12 @@
|
|||
|
||||
static bool args_contain_key(PyObject *kwargs, const char *name)
|
||||
{
|
||||
if (kwargs == NULL) {
|
||||
/* When a function gets called without any kwargs, Python just passes NULL instead.
|
||||
* PyDict_Contains() is not NULL-safe, though. */
|
||||
return false;
|
||||
}
|
||||
|
||||
PyObject *py_key = PyUnicode_FromString(name);
|
||||
const bool result = PyDict_Contains(kwargs, py_key) == 1;
|
||||
Py_DECREF(py_key);
|
||||
|
|
Loading…
Reference in New Issue