Fix #164433: Crash using Bake operator in viewport with hidden object

The bake operator's poll function checked both the context's `object` &
`active_object` properties, while invoke/exec only used `active_object`.
If only `object` is set, as is the case running from the viewport with
the current object hidden, poll would succeed, while invoke/exec would
get a nullptr and crash.

Fixed by using `context_active_object` to get the object for invoke/exec
to match poll.

Pull Request: https://projects.blender.org/blender/blender/pulls/164434
This commit is contained in:
Jorn Visser 2026-09-28 19:22:23 +02:00 • committed by Brecht Van Lommel
parent 98e452b04a
commit babb60703e

View file

@ -1854,7 +1854,7 @@ static void bake_init_api_data(wmOperator *op, bContext *C, BakeAPIRender *bkr)
{
bScreen *screen = CTX_wm_screen(C);
bkr->ob = CTX_data_active_object(C);
bkr->ob = context_active_object(C);
bkr->main = CTX_data_main(C);
bkr->view_layer = CTX_data_view_layer(C);
bkr->scene = CTX_data_scene(C);