diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-02-13 13:02:47 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-02-13 13:05:14 +0300 |
commit | 57f0b175d7c90886ef61e06a991f15c9e1da723c (patch) | |
tree | 87aab7656cec043e764b334a078ef1201ce58f8d /source | |
parent | 539cbf639faff9c92cc0eb53273c367838216e77 (diff) |
Fix T61487: quick favorites crash outside of open preferences window
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_context_menu.c | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_user_menu.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 0f5d3bb28c8..d8928e81ccd 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -710,7 +710,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) item_found = true; } } - MEM_freeN(um_array); + if (um_array) { + MEM_freeN(um_array); + } if (!item_found) { but2 = uiDefIconTextBut( diff --git a/source/blender/editors/screen/screen_user_menu.c b/source/blender/editors/screen/screen_user_menu.c index d0cc153f8c4..1f49eb2d5fc 100644 --- a/source/blender/editors/screen/screen_user_menu.c +++ b/source/blender/editors/screen/screen_user_menu.c @@ -59,6 +59,11 @@ bUserMenu **ED_screen_user_menus_find(const bContext *C, uint *r_len) SpaceLink *sl = CTX_wm_space_data(C); const char *context = CTX_data_mode_string(C); + if (sl == NULL) { + *r_len = 0; + return NULL; + } + uint array_len = 3; bUserMenu **um_array = MEM_calloc_arrayN(array_len, sizeof(*um_array), __func__); um_array[0] = BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context); @@ -253,7 +258,9 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu) } } } - MEM_freeN(um_array); + if (um_array) { + MEM_freeN(um_array); + } if (is_empty) { uiItemL(menu->layout, IFACE_("No menu items found"), ICON_NONE); |