Fix #105860: Out of bounds active layer index caused crashes elsewhere
Setting a negative active layer index was possible, causing a crash when adding new layers (for example). Clamp the active index when assigning from RNA.
This commit is contained in:
@@ -108,6 +108,12 @@
|
||||
Mesh *me = rna_mesh(ptr); \
|
||||
CustomData *data = rna_mesh_##customdata_type(ptr); \
|
||||
if (data) { \
|
||||
if (UNLIKELY(value < 0)) { \
|
||||
value = 0; \
|
||||
} \
|
||||
else if (value > 0) { \
|
||||
value = min_ii(value, CustomData_number_of_layers(data, layer_type) - 1); \
|
||||
} \
|
||||
CustomData_set_layer_##active_type(data, layer_type, value); \
|
||||
BKE_mesh_tessface_clear(me); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user