forked from bartvdbraak/blender
fix [#32779] Bmesh module: assigning to bm.select_mode crashes Blender if bmesh is empty
was missing set typecheck
This commit is contained in:
parent
c4472bbab6
commit
6a164c7f72
@ -760,7 +760,6 @@ int PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int *valu
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 'value' _must_ be a set type, error check before calling */
|
||||
int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
|
||||
{
|
||||
/* set of enum items, concatenate all values with OR */
|
||||
@ -771,6 +770,15 @@ int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, co
|
||||
Py_ssize_t hash = 0;
|
||||
PyObject *key;
|
||||
|
||||
PyC_ObSpit("", value);
|
||||
|
||||
if (!PySet_Check(value)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%.200s expected a set, not %.200s",
|
||||
error_prefix, Py_TYPE(value)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*r_value = 0;
|
||||
|
||||
while (_PySet_NextEntry(value, &pos, &key, &hash)) {
|
||||
@ -778,7 +786,7 @@ int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, co
|
||||
|
||||
if (param == NULL) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%.200s expected a string, not %.200s",
|
||||
"%.200s set must contain strings, not %.200s",
|
||||
error_prefix, Py_TYPE(key)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user