[Bf-blender-cvs] [909f47e0e19] master: UV: fix crash with uv copy on empty selection

Chris Blackbourn noreply at git.blender.org
Mon Nov 14 01:38:47 CET 2022


Commit: 909f47e0e19799df34d7bdf2a81867f2ea7f2cdc
Author: Chris Blackbourn
Date:   Mon Nov 14 13:35:43 2022 +1300
Branches: master
https://developer.blender.org/rB909f47e0e19799df34d7bdf2a81867f2ea7f2cdc

UV: fix crash with uv copy on empty selection

Introduced in 721fc9c1c950

===================================================================

M	source/blender/editors/uvedit/uvedit_clipboard.cc

===================================================================

diff --git a/source/blender/editors/uvedit/uvedit_clipboard.cc b/source/blender/editors/uvedit/uvedit_clipboard.cc
index d7222f04ba8..7ededf516bc 100644
--- a/source/blender/editors/uvedit/uvedit_clipboard.cc
+++ b/source/blender/editors/uvedit/uvedit_clipboard.cc
@@ -281,9 +281,10 @@ static int uv_copy_exec(bContext *C, wmOperator * /*op*/)
     const bool use_seams = false;
     UvElementMap *element_map = BM_uv_element_map_create(
         em->bm, scene, true, false, use_seams, true);
-
-    const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
-    uv_clipboard->append(element_map, cd_loop_uv_offset);
+    if (element_map) {
+      const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
+      uv_clipboard->append(element_map, cd_loop_uv_offset);
+    }
     BM_uv_element_map_free(element_map);
   }
 
@@ -317,6 +318,10 @@ static int uv_paste_exec(bContext *C, wmOperator * /*op*/)
     UvElementMap *dest_element_map = BM_uv_element_map_create(
         em->bm, scene, true, false, use_seams, true);
 
+    if (!dest_element_map) {
+      continue;
+    }
+
     for (int i = 0; i < dest_element_map->total_islands; i++) {
       blender::Vector<int> label;
       const bool found = uv_clipboard->find_isomorphism(



More information about the Bf-blender-cvs mailing list