Fix T69332: 'Reset to Default Value' on a custom string property crashes
authorPhilipp Oeser <info@graphics-engineer.com>
Thu, 21 Nov 2019 12:58:56 +0000 (13:58 +0100)
committerPhilipp Oeser <info@graphics-engineer.com>
Fri, 22 Nov 2019 11:13:10 +0000 (12:13 +0100)
Thx @campbellbarton for the heads up!

Maniphest Tasks: T69332

Differential Revision: https://developer.blender.org/D6284

source/blender/makesrna/intern/rna_access.c

index aeb6d528cdb0630e500dd4cb9952171c1215cc7a..78cd99837c30a0a88f680b38967f535ed908f1be 100644 (file)
@@ -3604,7 +3604,7 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr,
 /* this is the length without \0 terminator */
 int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 {
-  StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+  StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
 
   BLI_assert(RNA_property_type(prop) == PROP_STRING);