Fix T47657: Using template_list() with invoke_props_dialog()

popups have no wm_region in context, using wm_menu here.

Not working perfect, but at least it prevents crash.
This commit is contained in:
Bastien Montagne 2016-05-06 21:56:54 +02:00
parent 8c2cec937b
commit bd335f13fe
Notes: blender-bot 2023-02-14 19:49:50 +01:00
Referenced by issue blender/blender-addons#47657, Using template_list() with invoke_props_dialog()
1 changed files with 5 additions and 1 deletions

View File

@ -2947,7 +2947,11 @@ void uiTemplateList(
/* We tag the list id with the list type... */
BLI_snprintf(ui_list_id, sizeof(ui_list_id), "%s_%s", ui_list_type->idname, list_id ? list_id : "");
ar = CTX_wm_region(C);
/* Allows to work in popups. */
ar = CTX_wm_menu(C);
if (ar == NULL) {
ar = CTX_wm_region(C);
}
ui_list = BLI_findstring(&ar->ui_lists, ui_list_id, offsetof(uiList, list_id));
if (!ui_list) {