Fix: EEVEE/Workbench crash rendering without an active object

Regression from 62568d16e5, this was crashing most of the EEVEE
and Workbench render tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/141624
This commit is contained in:
Brecht Van Lommel
2025-07-08 18:38:41 +02:00
committed by Brecht Van Lommel
parent 7c8b8b2457
commit bfacc42651

View File

@@ -327,7 +327,7 @@ inline ResourceHandleRange Manager::unique_handle(const ObjectRef &ref)
inline ResourceHandleRange Manager::resource_handle(const ObjectRef &ref, float inflate_bounds)
{
bool is_active_object = (ref.dupli_object ? ref.dupli_parent : ref.object) == object_active;
bool is_edit_mode = DRW_object_is_in_edit_mode(object_active) &&
bool is_edit_mode = object_active && DRW_object_is_in_edit_mode(object_active) &&
ref.object->mode == object_active->mode;
matrix_buf.current().get_or_resize(resource_len_).sync(*ref.object);
bounds_buf.current().get_or_resize(resource_len_).sync(*ref.object, inflate_bounds);
@@ -341,7 +341,7 @@ inline ResourceHandle Manager::resource_handle(const ObjectRef &ref,
const float3 *bounds_half_extent)
{
bool is_active_object = (ref.dupli_object ? ref.dupli_parent : ref.object) == object_active;
bool is_edit_mode = DRW_object_is_in_edit_mode(object_active) &&
bool is_edit_mode = object_active && DRW_object_is_in_edit_mode(object_active) &&
ref.object->mode == object_active->mode;
if (model_matrix) {
matrix_buf.current().get_or_resize(resource_len_).sync(*model_matrix);
@@ -381,7 +381,8 @@ inline ResourceHandle Manager::resource_handle_for_psys(const ObjectRef &ref,
const float4x4 &model_matrix)
{
bool is_active_object = (ref.dupli_object ? ref.dupli_parent : ref.object) == object_active;
bool matches_active_object_edit_mode = object_active->mode == eObjectMode::OB_MODE_EDIT &&
bool matches_active_object_edit_mode = object_active &&
object_active->mode == eObjectMode::OB_MODE_EDIT &&
ref.object->mode == object_active->mode;
matrix_buf.current().get_or_resize(resource_len_).sync(model_matrix);
bounds_buf.current().get_or_resize(resource_len_).sync();