Fix T61780: Crash when trying to access screen areas through the outliner.

ScreenArea->type is NULL-ified on read, and need to be initialized
(usually by `ED_area_initialize()`), but RNA can also access it before
it happens, so need to do it itself...
This commit is contained in:
2019-03-05 14:06:19 +01:00
parent 6e95d8484c
commit 8b10e1b457

View File

@@ -256,6 +256,16 @@ static int rna_Area_ui_type_get(PointerRNA *ptr)
{
int value = rna_Area_type_get(ptr) << 16;
ScrArea *sa = ptr->data;
/* sa->type can be NULL (when not yet initialized), try to do it now. */
/* Copied from `ED_area_initialize()`.*/
if (sa->type == NULL) {
sa->type = BKE_spacetype_from_id(sa->spacetype);
if (sa->type == NULL) {
sa->spacetype = SPACE_VIEW3D;
sa->type = BKE_spacetype_from_id(sa->spacetype);
}
BLI_assert(sa->type != NULL);
}
if (sa->type->space_subtype_item_extend != NULL) {
value |= sa->type->space_subtype_get(sa);
}