diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_view.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 93554c374d9..53f343ed071 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1358,19 +1358,21 @@ static void game_set_commmandline_options(GameData *gm) static int game_engine_poll(bContext *C) { - bScreen *screen; + const wmWindow *win = CTX_wm_window(C); + const Scene *scene = WM_window_get_active_scene(win); + /* we need a context and area to launch BGE * it's a temporary solution to avoid crash at load time * if we try to auto run the BGE. Ideally we want the * context to be set as soon as we load the file. */ - if (CTX_wm_window(C) == NULL) return 0; - if ((screen = CTX_wm_screen(C)) == NULL) return 0; + if (win == NULL) return 0; + if (CTX_wm_screen(C) == NULL) return 0; if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT) return 0; - if (!BKE_scene_uses_blender_game(screen->scene)) + if (!BKE_scene_uses_blender_game(scene)) return 0; return 1; |