UV: fix crash with uv copy on empty selection

Introduced in 721fc9c1c9
This commit is contained in:
Chris Blackbourn
2022-11-14 13:35:43 +13:00
parent e0cb3e0a39
commit 909f47e0e1

View File

@@ -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(