diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-10 10:58:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-10 10:58:05 +0300 |
commit | a0f41ba8a24197782af5765c56525e79214d1464 (patch) | |
tree | 2944509e1da9d71f8e58664905f835644b39f5dd /source/blender/modifiers/intern/MOD_hook.c | |
parent | 92a1b3f75068b270a3061f1f3ff03cbdfecca7d8 (diff) |
Fix T80516: Hook modifier crashes without vertex group data
Checks for existence of a vertex group must check the array isn't NULL.
Regression in c1386795a922.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_hook.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_hook.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 98bbb328007..94a9a922ff7 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -313,10 +313,19 @@ static void deformVerts_do(HookModifierData *hmd, MOD_get_vgroup(ob, mesh, hmd->name, &dvert, &hd.defgrp_index); int cd_dvert_offset = -1; - if ((em != NULL) && (hd.defgrp_index != -1)) { - cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); - if (cd_dvert_offset == -1) { - hd.defgrp_index = -1; + if (hd.defgrp_index != -1) { + /* Edit-mesh. */ + if (em != NULL) { + cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); + if (cd_dvert_offset == -1) { + hd.defgrp_index = -1; + } + } + else { + /* Regular mesh. */ + if (dvert == NULL) { + hd.defgrp_index = -1; + } } } |