Fix T93949: Preview Image Error When No Screen

Fix an error if "File Preview Type" is "Auto" and there is no screen.

See D13574 for details.

Differential Revision: https://developer.blender.org/D13574

Reviewed by Julian Eisel
This commit is contained in:
Harley Acheson 2021-12-14 13:50:40 -08:00
parent 40aee0b2e9
commit 644eb68524
Notes: blender-bot 2023-02-14 09:19:09 +01:00
Referenced by issue #96860, Compositor: Missing output UI for Normal node
Referenced by issue #95903, Geometry node don't expose materials to the solidify modifier
Referenced by issue #95720, Spreadsheet does not display volume grid information for import vdb file
Referenced by issue #94209, Viewport artifacts, slowdown, and crashing on Arch Linux w/ Intel graphics after driver update
Referenced by issue #93949, save_as_mainfile will crash if context has no screen
Referenced by issue #93479, 3.0 Potential candidates for corrective releases
1 changed files with 3 additions and 2 deletions

View File

@ -1793,8 +1793,9 @@ static bool wm_file_write(bContext *C,
if (file_preview_type == USER_FILE_PREVIEW_AUTO) {
Scene *scene = CTX_data_scene(C);
bool do_render = (scene != NULL && scene->camera != NULL &&
(BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0) != NULL));
bScreen *screen = CTX_wm_screen(C);
bool do_render = (scene != NULL && scene->camera != NULL && screen != NULL &&
(BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0) != NULL));
file_preview_type = do_render ? USER_FILE_PREVIEW_CAMERA : USER_FILE_PREVIEW_SCREENSHOT;
}