[Bf-blender-cvs] [7eecc2e1c4] blender2.8: Fix T50958: `template_ID_preview` is crashing the blender's UI from branch 2.8

Julian Eisel noreply at git.blender.org
Thu Mar 16 18:54:18 CET 2017


Commit: 7eecc2e1c43ba9ca6da62f2a0931ff3ce206236c
Author: Julian Eisel
Date:   Thu Mar 16 16:04:20 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB7eecc2e1c43ba9ca6da62f2a0931ff3ce206236c

Fix T50958: `template_ID_preview` is crashing the blender's UI from branch 2.8

So apparently ID pointer is allowed to be NULL here.

===================================================================

M	source/blender/editors/interface/interface_templates.c

===================================================================

diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index f363623682..2f64100fa6 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -429,7 +429,8 @@ static void template_ID(
 		but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, width, height,
 		                     TIP_(template_id_browse_tip(type)));
 		if (use_preview_icon) {
-			ui_def_but_icon(but, ui_id_icon_get(C, id, use_big_size), UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
+			int icon = id ? ui_id_icon_get(C, id, use_big_size) : RNA_struct_ui_icon(type);
+			ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
 		}
 		else {
 			ui_def_but_icon(but, RNA_struct_ui_icon(type), UI_HAS_ICON);




More information about the Bf-blender-cvs mailing list