Fix #28733, #29885: fix missing scene in context in python. The window manager
[blender.git] / source / blender / blenkernel / intern / context.c
index 9e9a0ca2d547b7f3a53fd2d581b356b9a20b9b95..05c56fa81019f15660bb39bd9b84937c10a66ad9 100644 (file)
@@ -381,7 +381,8 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
 {
        C->wm.window= win;
        C->wm.screen= (win)? win->screen: NULL;
-       C->data.scene= (C->wm.screen)? C->wm.screen->scene: NULL;
+       if(C->wm.screen)
+               C->data.scene= C->wm.screen->scene;
        C->wm.area= NULL;
        C->wm.region= NULL;
 }
@@ -389,7 +390,8 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
 void CTX_wm_screen_set(bContext *C, bScreen *screen)
 {
        C->wm.screen= screen;
-       C->data.scene= (C->wm.screen)? C->wm.screen->scene: NULL;
+       if(C->wm.screen)
+               C->data.scene= C->wm.screen->scene;
        C->wm.area= NULL;
        C->wm.region= NULL;
 }