From 523b95898bc6ec94171eccee9f3a8801e10c233a Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Mon, 26 Apr 2010 20:30:13 +0000 Subject: Add missing null check solving crash on texture panel, also fix possible 'freeing NULL' because of misplaced MEM_freeN() in that context. --- source/blender/editors/interface/interface_layout.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 2ae1a549db9..762203272a3 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1105,9 +1105,11 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui if(flag & PROP_ID_SELF_CHECK) if(itemptr.data == but->rnapoin.id.data) continue; - - if(RNA_struct_is_ID(itemptr.type)) + + if(itemptr.type && RNA_struct_is_ID(itemptr.type)) iconid= ui_id_icon_get((bContext*)C, itemptr.data, 0); + else + iconid = 0; name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); @@ -1119,8 +1121,8 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui cis->iconid = iconid; BLI_addtail(items_list, cis); } + MEM_freeN(name); } - MEM_freeN(name); i++; } -- cgit v1.2.3