diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-31 15:52:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-31 15:52:22 +0300 |
commit | 70fdf0fe37b37e798a5e116415c8699e3d652481 (patch) | |
tree | e3cc19476701686b9da48982df8b079101c00a5f /source/blender/blenkernel/intern/idprop.c | |
parent | 0be064067a432da070add207a7f4a3201ce7f071 (diff) | |
parent | ff693959d89aeb7f763e0286f6fe63bdde20057c (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 31d98a00610..65d3f9e93fc 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -130,18 +130,22 @@ void IDP_FreeIDPArray(IDProperty *prop) MEM_freeN(prop->data.pointer); } -/*shallow copies item*/ +/* shallow copies item */ void IDP_SetIndexArray(IDProperty *prop, int index, IDProperty *item) { IDProperty *old; BLI_assert(prop->type == IDP_IDPARRAY); + if (index >= prop->len || index < 0) + return; + old = GETPROP(prop, index); - if (index >= prop->len || index < 0) return; - if (item != old) IDP_FreeProperty(old); - - memcpy(GETPROP(prop, index), item, sizeof(IDProperty)); + if (item != old) { + IDP_FreeProperty(old); + + memcpy(old, item, sizeof(IDProperty)); + } } IDProperty *IDP_GetIndexArray(IDProperty *prop, int index) |