Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-09-10 10:58:05 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-21 10:17:36 +0300
commit21e3b89634d3d517518dc340b8b26775aff500d2 (patch)
tree9f2b10b7f0f19f94d91be5a3b686df49ae197739
parent5f66510a212d70a516f31ce3d9dec3ca495a04e7 (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.
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c17
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 083348dfb26..a55be041c91 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;
+ }
}
}