From 279b9f43f3703f0d6403c7eca712870de26a3a55 Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues Date: Sun, 28 Feb 2021 20:09:55 +0000 Subject: [PATCH] Fix crash in GIProbe::bake The problem happened when the passed from_node was null and the GIProbe node had no parent node. Fixes #45978 (cherry picked from commit 82fed7b6da9882fb2f3cea4bd247eb02f4336b15) --- scene/3d/gi_probe.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 26b9b0c8760..e0b21e48356 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -399,13 +399,16 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { static const int subdiv_value[SUBDIV_MAX] = { 7, 8, 9, 10 }; + p_from_node = p_from_node ? p_from_node : get_parent(); + ERR_FAIL_NULL(p_from_node); + VoxelLightBaker baker; baker.begin_bake(subdiv_value[subdiv], AABB(-extents, extents * 2.0)); List 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);