Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 7525b799067..cffcc738b5a 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -566,7 +566,12 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
{
drawEMTFMapped_userData *data = userData;
BMEditMesh *em = data->em;
- BMFace *efa = EDBM_face_at_index(em, index);
+ BMFace *efa;
+
+ if (UNLIKELY(index >= em->bm->totface))
+ return DM_DRAW_OPTION_NORMAL;
+
+ efa = EDBM_face_at_index(em, index);
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_SKIP;
@@ -922,7 +927,13 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
/* editmode face hiding */
TexMatCallback *data = (TexMatCallback *)userData;
Mesh *me = (Mesh *)data->me;
- BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index);
+ BMEditMesh *em = me->edit_btmesh;
+ BMFace *efa;
+
+ if (UNLIKELY(index >= em->bm->totface))
+ return DM_DRAW_OPTION_NORMAL;
+
+ efa = EDBM_face_at_index(em, index);
return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
}