diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-27 12:20:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-27 12:20:02 +0400 |
commit | 2123386c70a740bc8177fb16011c0cf65dd8a2f3 (patch) | |
tree | cba98deaa189e1a2438444f9493d9b80c53d6ba7 | |
parent | caf6bf80f7e11a814482ce4298551729e8ed2976 (diff) |
Fix T37249: Crash calling wm.progress_update() with no active window
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 91cddd28be0..923e7f98360 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -135,16 +135,22 @@ static void rna_progress_update(struct wmWindowManager *wm, float value) { if (wm_progress_state.is_valid) { /* Map to cursor_time range [0,9999] */ - int val = (int)(10000 * (value - wm_progress_state.min) / (wm_progress_state.max - wm_progress_state.min)); - WM_cursor_time(wm->winactive, val); + wmWindow *win = wm->winactive; + if (win) { + int val = (int)(10000 * (value - wm_progress_state.min) / (wm_progress_state.max - wm_progress_state.min)); + WM_cursor_time(win, val); + } } } static void rna_progress_end(struct wmWindowManager *wm) { if (wm_progress_state.is_valid) { - WM_cursor_modal_restore(wm->winactive); - wm_progress_state.is_valid = false; + wmWindow *win = wm->winactive; + if (win) { + WM_cursor_modal_restore(win); + wm_progress_state.is_valid = false; + } } } |