diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-01-13 14:26:10 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-01-13 14:27:05 +0400 |
commit | d01bb0b8b6653f9a9e36c5d992f80d20405ee715 (patch) | |
tree | 21137d258dac22800e7af3a316fdd9b4247c53b8 | |
parent | 63095e492b21a82b9235249f273d2be0e5858eea (diff) |
Avoid memcpy to self when validating UV layer name
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index b2738f5c7f0..0905ce10f16 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -647,8 +647,13 @@ bool BKE_mesh_uv_cdlayer_rename_index(Mesh *me, const int poly_index, const int cdlu = &ldata->layers[loop_index]; cdlf = fdata && do_tessface ? &fdata->layers[face_index] : NULL; - BLI_strncpy(cdlp->name, new_name, sizeof(cdlp->name)); - CustomData_set_layer_unique_name(pdata, cdlp - pdata->layers); + if (cdlp->name != name) { + /* Mesh validate passes a name from the CD layer as the new name, + * Avoid memcpy from self to self in this case. + */ + BLI_strncpy(cdlp->name, new_name, sizeof(cdlp->name)); + CustomData_set_layer_unique_name(pdata, cdlp - pdata->layers); + } /* Loop until we do have exactly the same name for all layers! */ for (i = 1; (strcmp(cdlp->name, cdlu->name) != 0 || (cdlf && strcmp(cdlp->name, cdlf->name) != 0)); i++) { |