Skip to content

Commit af79974

Browse files
committed
Merge pull request #106464 from smix8/gridmap_scenario_fix
Fix GridMap scenario crash when outside tree
2 parents 608320e + db6a22c commit af79974

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/gridmap/grid_map.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) {
8383

8484
Array meshes = p_value;
8585

86-
const RID scenario = get_world_3d()->get_scenario();
86+
RID scenario;
87+
if (is_inside_tree()) {
88+
scenario = get_world_3d()->get_scenario();
89+
}
8790

8891
for (int i = 0; i < meshes.size(); i++) {
8992
BakedMesh bm;

0 commit comments

Comments
 (0)