[Bf-blender-cvs] [c998d6d] master: Fix T40224: Crash moving objects to another layer

Campbell Barton noreply at git.blender.org
Tue May 20 13:03:33 CEST 2014


Commit: c998d6d4b5a3bd88375c3255761e1e64a5321559
Author: Campbell Barton
Date:   Tue May 20 21:01:02 2014 +1000
https://developer.blender.org/rBc998d6d4b5a3bd88375c3255761e1e64a5321559

Fix T40224: Crash moving objects to another layer

passing NULL to BLI_sprintfN crashed in some cases.

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

M	source/blender/makesrna/intern/rna_access.c

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

diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index ded0278..270c350 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -4548,7 +4548,8 @@ char *RNA_path_full_struct_py(struct PointerRNA *ptr)
 char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
 	char *id_path;
-	char *data_path;
+	const char *data_path_fallback = "(null)";
+	const char *data_path;
 
 	char *ret;
 
@@ -4560,6 +4561,9 @@ char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
 	id_path = RNA_path_full_ID_py(ptr->id.data);
 
 	data_path = RNA_path_from_ID_to_property(ptr, prop);
+	if (data_path == NULL) {
+		data_path = data_path_fallback;
+	}
 
 	if ((index == -1) || (RNA_property_array_check(prop) == false)) {
 		ret = BLI_sprintfN("%s.%s",
@@ -4570,8 +4574,8 @@ char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
 		                   id_path, data_path, index);
 	}
 	MEM_freeN(id_path);
-	if (data_path) {
-		MEM_freeN(data_path);
+	if (data_path != data_path_fallback) {
+		MEM_freeN((void *)data_path);
 	}
 
 	return ret;




More information about the Bf-blender-cvs mailing list