[Bf-blender-cvs] [bdda315] asset-experiments: Fix crasher (Looks like PointerRNA->type can be NULL...).

Bastien Montagne noreply at git.blender.org
Sun Jan 25 15:33:56 CET 2015


Commit: bdda3152607784ce59ac537264d2efc8f44363fa
Author: Bastien Montagne
Date:   Sun Jan 25 14:59:04 2015 +0100
Branches: asset-experiments
https://developer.blender.org/rBbdda3152607784ce59ac537264d2efc8f44363fa

Fix crasher (Looks like PointerRNA->type can be NULL...).

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

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 6316ec6..5a4a6bc 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2838,20 +2838,21 @@ static void uilist_resize_update_cb(bContext *UNUSED(C), void *arg1, void *UNUSE
 
 static const char *uilist_generate_advanced_tooltip(char *tooltip_buff, size_t tooltip_len, PointerRNA *itemptr)
 {
-	PropertyRNA *prop = RNA_struct_find_property(itemptr, "uilist_dynamic_tooltip");
+	if (itemptr && itemptr->data) {
+		PropertyRNA *prop = RNA_struct_find_property(itemptr, "uilist_dynamic_tooltip");
 
-	if (prop && (RNA_property_type(prop) == PROP_STRING)) {
-		char dyn_tooltip_buff[UILIST_TOOLTIP_LEN];
-		char *dyn_tooltip = RNA_property_string_get_alloc(itemptr, prop, dyn_tooltip_buff, sizeof(dyn_tooltip_buff), NULL);
+		if (prop && (RNA_property_type(prop) == PROP_STRING)) {
+			char dyn_tooltip_buff[UILIST_TOOLTIP_LEN];
+			char *dyn_tooltip = RNA_property_string_get_alloc(itemptr, prop, dyn_tooltip_buff, sizeof(dyn_tooltip_buff), NULL);
 
-		BLI_snprintf(tooltip_buff, tooltip_len, "%s - %s", TIP_(UILIST_RENAME_TOOLTIP), dyn_tooltip);
+			BLI_snprintf(tooltip_buff, tooltip_len, "%s - %s", TIP_(UILIST_RENAME_TOOLTIP), dyn_tooltip);
 
-		if (dyn_tooltip != dyn_tooltip_buff) {
-			MEM_freeN(dyn_tooltip);
-		}
-
-		return tooltip_buff;
+			if (dyn_tooltip != dyn_tooltip_buff) {
+				MEM_freeN(dyn_tooltip);
+			}
 
+			return tooltip_buff;
+		}
 	}
 
 	return TIP_(UILIST_RENAME_TOOLTIP);




More information about the Bf-blender-cvs mailing list