diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2020-05-15 14:37:04 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2020-05-15 14:39:35 +0300 |
commit | a5d394fad23280687880aee0082797cf8dd1cdd5 (patch) | |
tree | 8782b5e322c628d5cc1352dfdc15bf2eecc653c3 /source/blender/editors/mesh | |
parent | 3a14c011f9fb35cf7432f6bc7f96cb18cacc8255 (diff) |
Fix segfault when trying to free uninitialized loop normals
Forgot this corner case when I created the new normal flip code.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index bfd88de4c66..684bb73dc0e 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2104,7 +2104,10 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op) if (flip_custom_normals(em->bm, lnors_ed_arr) || has_flipped_faces) { EDBM_update_generic(obedit->data, true, false); } - BM_loop_normal_editdata_array_free(lnors_ed_arr); + + if (lnors_ed_arr != NULL) { + BM_loop_normal_editdata_array_free(lnors_ed_arr); + } } MEM_freeN(objects); @@ -2419,7 +2422,9 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op) if (inside) { EDBM_op_callf(em, op, "reverse_faces faces=%hf flip_multires=%b", BM_ELEM_SELECT, true); flip_custom_normals(em->bm, lnors_ed_arr); - BM_loop_normal_editdata_array_free(lnors_ed_arr); + if (lnors_ed_arr != NULL) { + BM_loop_normal_editdata_array_free(lnors_ed_arr); + } } EDBM_update_generic(obedit->data, true, false); |