Assets/UI: Sanity check argument for UILayout.template_asset_view()

Was already doing some sanity checks, but wasn't checking if the passed
property actually is a collection property, which is important.
This commit is contained in:
Julian Eisel 2021-07-29 17:14:52 +02:00
parent 5be54cce36
commit 49c0b9ec43
1 changed files with 4 additions and 0 deletions

View File

@ -162,6 +162,10 @@ static void asset_view_template_refresh_asset_collection(
RNA_warning("Asset collection not found");
return;
}
if (RNA_property_type(assets_prop) != PROP_COLLECTION) {
RNA_warning("Expected a collection property");
return;
}
if (!RNA_struct_is_a(RNA_property_pointer_type(&assets_dataptr, assets_prop),
&RNA_AssetHandle)) {
RNA_warning("Expected a collection property for AssetHandle items");