From 9170e4925058eb932988a829c1fb06505447e4cd Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 4 Apr 2017 15:57:45 +0200 Subject: [PATCH] Fix missing protection of `RNA_pointer_as_string()` against NULL pointers. Odd that issue was never reached before? Looks like it hit in datablock_idprops branch though... --- source/blender/makesrna/intern/rna_access.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index bb839fd77f8..7266cfb12d6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -5547,6 +5547,9 @@ static char *rna_pointer_as_string__bldata(PointerRNA *ptr) return BLI_strdup("None"); } else if (RNA_struct_is_ID(ptr->type)) { + if (ptr->id.data == NULL) { + return BLI_strdup("None"); + } return RNA_path_full_ID_py(ptr->id.data); } else { @@ -5556,7 +5559,10 @@ static char *rna_pointer_as_string__bldata(PointerRNA *ptr) char *RNA_pointer_as_string(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *prop_ptr, PointerRNA *ptr_prop) { - if (RNA_property_flag(prop_ptr) & PROP_IDPROPERTY) { + if (ptr_prop->data == NULL) { + return BLI_strdup("None"); + } + else if (RNA_property_flag(prop_ptr) & PROP_IDPROPERTY) { return RNA_pointer_as_string_id(C, ptr_prop); } else {