Fix T61487: quick favorites crash outside of open preferences window

This commit is contained in:
2019-02-13 11:02:47 +01:00
parent 539cbf639f
commit 57f0b175d7
2 changed files with 11 additions and 2 deletions

View File

@@ -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);