From 2606831d71c64761e63ac939e7902f024e4ca6c2 Mon Sep 17 00:00:00 2001 From: Garteal Date: Fri, 19 Jul 2024 14:10:10 +0200 Subject: [PATCH] SDFGI: fix crash if update_data is nullptr --- servers/rendering/renderer_rd/environment/gi.cpp | 4 ++++ .../forward_clustered/render_forward_clustered.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/servers/rendering/renderer_rd/environment/gi.cpp b/servers/rendering/renderer_rd/environment/gi.cpp index c7752f8a86d..12ff28d7b05 100644 --- a/servers/rendering/renderer_rd/environment/gi.cpp +++ b/servers/rendering/renderer_rd/environment/gi.cpp @@ -1790,6 +1790,10 @@ void GI::SDFGI::debug_probes(RID p_framebuffer, const uint32_t p_view_count, con } void GI::SDFGI::pre_process_gi(const Transform3D &p_transform, RenderDataRD *p_render_data) { + if (p_render_data->sdfgi_update_data == nullptr) { + return; + } + RendererRD::LightStorage *light_storage = RendererRD::LightStorage::get_singleton(); /* Update general SDFGI Buffer */ diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index f97ed3d2156..ad19f36257e 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -1126,6 +1126,10 @@ void RenderForwardClustered::_setup_lightmaps(const RenderDataRD *p_render_data, /* SDFGI */ void RenderForwardClustered::_update_sdfgi(RenderDataRD *p_render_data) { + if (p_render_data->sdfgi_update_data == nullptr) { + return; + } + Ref rb; if (p_render_data && p_render_data->render_buffers.is_valid()) { rb = p_render_data->render_buffers;