diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-17 22:07:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-17 22:09:06 +0300 |
commit | 7019c2bb7f9b8fd27e8f0cc5b72b262e2de584a9 (patch) | |
tree | 71112c418032a1849d405fe01c9f0d86ddfc8612 | |
parent | 0b6631414b031f1ddd0ab2288ecdafdb909f15bd (diff) |
Alternate fix for T42619: NULL check in caller
Rather avoid paranoid style, (wm == NULL) is an exceptional case.
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f8db1961f53..4828e6e512c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3523,13 +3523,14 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot) /* find window that owns the animation timer */ bScreen *ED_screen_animation_playing(const wmWindowManager *wm) { - wmWindow *window; + wmWindow *win; + + for (win = wm->windows.first; win; win = win->next) { + if (win->screen->animtimer) { + return win->screen; + } + } - if (wm) - for (window = wm->windows.first; window; window = window->next) - if (window->screen->animtimer) - return window->screen; - return NULL; } diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 86a28fb80bf..7b01acff6a5 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -110,7 +110,9 @@ static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), static int rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr)) { - return (ED_screen_animation_playing(G.main->wm.first) != NULL); + /* can be NULL on file load, T42619 */ + wmWindowManager *wm = G.main->wm.first; + return wm ? (ED_screen_animation_playing(wm) != NULL) : 0; } static int rna_Screen_fullscreen_get(PointerRNA *ptr) |