diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-05 16:06:19 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-05 16:09:18 +0300 |
commit | 8b10e1b45798b39fd63adef65f2eae0c7fbadbac (patch) | |
tree | ae443c240e849c59ad2303ad5c011f9e244603dc /source/blender/makesrna/intern/rna_screen.c | |
parent | 6e95d8484caf5cd5c6b9e34ce662516e0e78ee88 (diff) |
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...
Diffstat (limited to 'source/blender/makesrna/intern/rna_screen.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 095aab53c10..0f363810ed2 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -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); } |