UI: Prevent crash when opening file browser with mouse not in window
authorSybren A. Stüvel <sybren@blender.org>
Tue, 17 Dec 2019 14:55:48 +0000 (15:55 +0100)
committerSybren A. Stüvel <sybren@blender.org>
Tue, 17 Dec 2019 14:55:48 +0000 (15:55 +0100)
When the mouse is not inside the Blender window, `CTX_wm_area(C)` returns
`NULL`, but this wasn't checked for.

source/blender/editors/screen/screen_edit.c

index 5b8fd33a4e9ecb30f841b099e11b85948f9aa455..501c36286d0b0074da68bc053619a4db9e8dfc15 100644 (file)
@@ -1389,13 +1389,13 @@ ScrArea *ED_screen_temp_space_open(bContext *C,
     case USER_TEMP_SPACE_DISPLAY_FULLSCREEN: {
       ScrArea *ctx_sa = CTX_wm_area(C);
 
-      if (ctx_sa->full) {
+      if (ctx_sa != NULL && ctx_sa->full) {
         sa = ctx_sa;
         ED_area_newspace(C, ctx_sa, space_type, true);
         sa->flag |= AREA_FLAG_STACKED_FULLSCREEN;
         ((SpaceLink *)sa->spacedata.first)->link_flag |= SPACE_FLAG_TYPE_TEMPORARY;
       }
-      else if (ctx_sa->spacetype == space_type) {
+      else if (ctx_sa != NULL && ctx_sa->spacetype == space_type) {
         sa = ED_screen_state_toggle(C, CTX_wm_window(C), ctx_sa, SCREENMAXIMIZED);
       }
       else {