Fix (unreported) potential crash.
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 9 Jan 2018 18:51:50 +0000 (19:51 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 9 Jan 2018 18:51:50 +0000 (19:51 +0100)
RNA_pointer_as_string could return NULL instead of a valid string in some cases.

source/blender/makesrna/intern/rna_access.c

index 1f974f3a4402efba5c102ddc8dfc012c79763658..b0a77f9b90aa146a6b7e31a25fbd38c70a625ab3 100644 (file)
@@ -5745,13 +5745,10 @@ char *RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr)
 
 static char *rna_pointer_as_string__bldata(PointerRNA *ptr)
 {
-       if (ptr->type == NULL) {
+       if (ptr->type == NULL || ptr->id.data == NULL) {
                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 {