diff options
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_conv.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 7b102c9283b..bb61f66e267 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -804,10 +804,10 @@ void BM_mesh_bm_to_me( BMEditSelection *selected; me->totselect = BLI_listbase_count(&(bm->selected)); - if (me->mselect) MEM_freeN(me->mselect); - - me->mselect = MEM_callocN(sizeof(MSelect) * me->totselect, "Mesh selection history"); - + MEM_SAFE_FREE(me->mselect); + if (me->totselect != 0) { + me->mselect = MEM_mallocN(sizeof(MSelect) * me->totselect, "Mesh selection history"); + } for (i = 0, selected = bm->selected.first; selected; i++, selected = selected->next) { if (selected->htype == BM_VERT) { |