diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-20 15:01:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-20 15:01:02 +0400 |
commit | c998d6d4b5a3bd88375c3255761e1e64a5321559 (patch) | |
tree | 15da7797095fdb5c938f6a9d48132f96bce0236d /source | |
parent | 358664a28a526750fa61c6342cd8860d69398f66 (diff) |
Fix T40224: Crash moving objects to another layer
passing NULL to BLI_sprintfN crashed in some cases.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index ded0278b44d..270c35066a8 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; |