diff options
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 6bde0a501f3..99104ad6b83 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -655,21 +655,25 @@ void DM_add_poly_layer(DerivedMesh *dm, int type, int alloctype, void *layer) void *DM_get_vert_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumVerts(dm)); return CustomData_get(&dm->vertData, index, type); } void *DM_get_edge_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumEdges(dm)); return CustomData_get(&dm->edgeData, index, type); } void *DM_get_tessface_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumTessFaces(dm)); return CustomData_get(&dm->faceData, index, type); } void *DM_get_poly_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumPolys(dm)); return CustomData_get(&dm->polyData, index, type); } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index b6c608661cd..83685477725 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2073,6 +2073,8 @@ void *CustomData_get(const CustomData *data, int index, int type) int offset; int layer_index; + BLI_assert(index >= 0); + /* get the layer index of the active layer of type */ layer_index = CustomData_get_active_layer_index(data, type); if (layer_index < 0) return NULL; @@ -2088,6 +2090,8 @@ void *CustomData_get_n(const CustomData *data, int type, int index, int n) int layer_index; int offset; + BLI_assert(index >= 0 && n >= 0); + /* get the layer index of the first layer of type */ layer_index = data->typemap[type]; if (layer_index < 0) return NULL; |