summaryrefslogtreecommitdiff
path: root/scene/3d/spatial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/spatial.cpp')
-rw-r--r--scene/3d/spatial.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index efd418e3c7..1a41a31253 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -506,6 +506,8 @@ bool Spatial::is_set_as_toplevel() const {
Ref<World> Spatial::get_world() const {
ERR_FAIL_COND_V(!is_inside_world(), Ref<World>());
+ ERR_FAIL_COND_V(!data.viewport, Ref<World>());
+
return data.viewport->find_world();
}