Cleanup: remove paranoid 'MDeformVert.totweight < 0' check

This was added in 1cb7267a9f, however the behavior before this
would have failed on negative values already.

Also negative values here would fail in many other places.
This commit is contained in:
Campbell Barton 2020-08-29 10:48:33 +10:00
parent 141a3e6d47
commit bfa78aceed
1 changed files with 2 additions and 2 deletions

View File

@ -1554,10 +1554,10 @@ void BKE_defvert_blend_read(BlendDataReader *reader, int count, MDeformVert *mdv
}
for (int i = count; i > 0; i--, mdverts++) {
/*convert to vgroup allocation system*/
/* Convert to vertex group allocation system. */
MDeformWeight *dw;
if (mdverts->dw && (dw = BLO_read_get_new_data_address(reader, mdverts->dw))) {
const size_t dw_len = MAX2(mdverts->totweight, 0) * sizeof(MDeformWeight);
const size_t dw_len = sizeof(MDeformWeight) * mdverts->totweight;
void *dw_tmp = MEM_mallocN(dw_len, __func__);
memcpy(dw_tmp, dw, dw_len);
mdverts->dw = dw_tmp;