pyapi internal api code: check for == -1 rather then < 0, for known error returns.
This commit is contained in:
@@ -101,7 +101,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
|
||||
|
||||
if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
|
||||
if (cb_event_str) {
|
||||
if (pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0) {
|
||||
if (pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") == -1) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -212,10 +212,10 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0) {
|
||||
if (pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") == -1) {
|
||||
return NULL;
|
||||
}
|
||||
else if (pyrna_enum_value_from_id(region_type_items, cb_regiontype_str, &cb_regiontype, "bpy_struct.callback_add()") < 0) {
|
||||
else if (pyrna_enum_value_from_id(region_type_items, cb_regiontype_str, &cb_regiontype, "bpy_struct.callback_add()") == -1) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -278,7 +278,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
|
||||
customdata = ED_region_draw_cb_customdata(handle);
|
||||
Py_DECREF((PyObject *)customdata);
|
||||
|
||||
if (pyrna_enum_value_from_id(region_type_items, cb_regiontype_str, &cb_regiontype, "bpy_struct.callback_remove()") < 0) {
|
||||
if (pyrna_enum_value_from_id(region_type_items, cb_regiontype_str, &cb_regiontype, "bpy_struct.callback_remove()") == -1) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user