Fix T55427: Removing Vertex Group used by Data Transfer Modifier results in crash.

Only fixing crash, proper handling (a.k.a remapping) of all
possible cases here, for all possible data layers, is rather involved...
This commit is contained in:
Bastien Montagne 2018-06-16 16:19:53 +02:00
parent 35c71aed25
commit ace8ad861d
Notes: blender-bot 2023-02-14 05:45:26 +01:00
Referenced by issue #55427, Removing Vertex Group used by Data Transfer Modifier results in crash
1 changed files with 6 additions and 1 deletions

View File

@ -1189,7 +1189,12 @@ bool data_transfer_layersmapping_vgroups(
if (fromlayers >= 0) {
idx_src = fromlayers;
BLI_assert(idx_src < BLI_listbase_count(&ob_src->defbase));
if (idx_src >= BLI_listbase_count(&ob_src->defbase)) {
/* This can happen when vgroups are removed from source object...
* Remapping would be really tricky here, we'd need to go over all objects in Main everytime we delete
* a vgroup... for now, simpler and safer to abort. */
return false;
}
}
else if ((idx_src = ob_src->actdef - 1) == -1) {
return false;