diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-12-09 16:30:23 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-12-09 16:30:23 +0300 |
commit | 37bf71ad0475549e0458f1e864a30c68c5880e88 (patch) | |
tree | 9b23496330fee751eca4da635cdcad33c9fa8ccf /source/blender/editors/transform/transform_mode_shrink_fatten.c | |
parent | b9eb5921332922757acacd2c9251d8c89c9a239a (diff) |
Fix T83588: Crash with Shrink/Fatten and Offset Even
`t->keymap` can be `NULL`.
Bug introduced in rBc822f66bb83
Diffstat (limited to 'source/blender/editors/transform/transform_mode_shrink_fatten.c')
-rw-r--r-- | source/blender/editors/transform/transform_mode_shrink_fatten.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform_mode_shrink_fatten.c b/source/blender/editors/transform/transform_mode_shrink_fatten.c index 6058a2824e9..2a5c631df41 100644 --- a/source/blender/editors/transform/transform_mode_shrink_fatten.c +++ b/source/blender/editors/transform/transform_mode_shrink_fatten.c @@ -50,7 +50,7 @@ static eRedrawFlag shrinkfatten_handleEvent(struct TransInfo *t, const wmEvent * { BLI_assert(t->mode == TFM_SHRINKFATTEN); wmKeyMapItem *kmi = t->custom.mode.data; - if (event->type == kmi->type && event->val == kmi->val) { + if (kmi && event->type == kmi->type && event->val == kmi->val) { /* Allows the 'Even Thickness' effect to be enabled as a toogle. */ t->flag ^= T_ALT_TRANSFORM; return TREDRAW_HARD; @@ -90,12 +90,11 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) } ofs += BLI_strncpy_rlen(str + ofs, ", (", sizeof(str) - ofs); - if (t->keymap) { - wmKeyMapItem *kmi = t->custom.mode.data; - if (kmi) { - ofs += WM_keymap_item_to_string(kmi, false, str + ofs, sizeof(str) - ofs); - } + wmKeyMapItem *kmi = t->custom.mode.data; + if (kmi) { + ofs += WM_keymap_item_to_string(kmi, false, str + ofs, sizeof(str) - ofs); } + BLI_snprintf(str + ofs, sizeof(str) - ofs, TIP_(" or Alt) Even Thickness %s"), @@ -149,8 +148,10 @@ void initShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; - /* Workaround to use the same key as the modal keymap. */ - t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE); + if (t->keymap) { + /* Workaround to use the same key as the modal keymap. */ + t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE); + } } } /** \} */ |