Cleanup: Avoid ASAN report when converting displist to mesh

Don't call `memcpy` with a null destination (and 0 size).
This commit is contained in:
Hans Goudey 2021-06-28 16:56:30 -05:00
parent d0e6b59cd1
commit 2271b9b584
1 changed files with 12 additions and 4 deletions

View File

@ -545,10 +545,18 @@ Mesh *BKE_mesh_new_nomain_from_curve_displist(const Object *ob, const ListBase *
mesh = BKE_mesh_new_nomain(totvert, totedge, 0, totloop, totpoly);
mesh->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
memcpy(mesh->mvert, allvert, totvert * sizeof(MVert));
memcpy(mesh->medge, alledge, totedge * sizeof(MEdge));
memcpy(mesh->mloop, allloop, totloop * sizeof(MLoop));
memcpy(mesh->mpoly, allpoly, totpoly * sizeof(MPoly));
if (totvert != 0) {
memcpy(mesh->mvert, allvert, totvert * sizeof(MVert));
}
if (totedge != 0) {
memcpy(mesh->medge, alledge, totedge * sizeof(MEdge));
}
if (totloop != 0) {
memcpy(mesh->mloop, allloop, totloop * sizeof(MLoop));
}
if (totpoly != 0) {
memcpy(mesh->mpoly, allpoly, totpoly * sizeof(MPoly));
}
if (alluv) {
const char *uvname = "UVMap";