RNA: fix a crash when setting bare IDProperty pointers.

The rna_idproperty_check call should be done before accessing
the prop pointer so that it can detect IDProperty values and
replace them with the actual PointerPropertyRNA object.

Ref D10098
This commit is contained in:
Alexander Gavrilov 2021-01-13 12:33:39 +03:00
parent 38df935c09
commit 8185d07ace
1 changed files with 3 additions and 1 deletions

View File

@ -3678,8 +3678,10 @@ void RNA_property_pointer_set(PointerRNA *ptr,
PointerRNA ptr_value,
ReportList *reports)
{
PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
/* Detect IDProperty and retrieve the actual PropertyRNA pointer before cast. */
IDProperty *idprop = rna_idproperty_check(&prop, ptr);
PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
/* Check types. */