Alternate fix for T42619: NULL check in caller

Rather avoid paranoid style, (wm == NULL) is an exceptional case.
This commit is contained in:
Campbell Barton 2014-11-17 20:07:25 +01:00
parent 0b6631414b
commit 7019c2bb7f
2 changed files with 10 additions and 7 deletions

View File

@ -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;
}

View File

@ -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)