summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-02-28 22:31:27 +0100
committerGitHub <noreply@github.com>2021-02-28 22:31:27 +0100
commit165d77a496f40fd87d85a75a8e6734f2ebec9d03 (patch)
treead591272b5f19f70c5cf9cb22ddf841735b461b5
parente3dd38c9f0064a8fa81d934fc5323d5816e710e4 (diff)
parent82fed7b6da9882fb2f3cea4bd247eb02f4336b15 (diff)
Merge pull request #46526 from pdfrod/fix-crash-on-giprobe-bake
Fix crash in GIProbe::bake
-rw-r--r--scene/3d/gi_probe.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 8a8bfe50b9..43f820e5d4 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -415,13 +415,16 @@ Vector3i GIProbe::get_estimated_cell_size() const {
void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
static const int subdiv_value[SUBDIV_MAX] = { 6, 7, 8, 9 };
+ p_from_node = p_from_node ? p_from_node : get_parent();
+ ERR_FAIL_NULL(p_from_node);
+
Voxelizer baker;
baker.begin_bake(subdiv_value[subdiv], AABB(-extents, extents * 2.0));
List<PlotMesh> mesh_list;
- _find_meshes(p_from_node ? p_from_node : get_parent(), mesh_list);
+ _find_meshes(p_from_node, mesh_list);
if (bake_begin_function) {
bake_begin_function(mesh_list.size() + 1);