From 7d8d337b2c47df88498067ff9091386691242144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20T=C3=BCrkal?= Date: Sat, 22 Jun 2019 15:52:51 +0300 Subject: fix some crashes --- scene/3d/spatial.cpp | 2 ++ scene/3d/visual_instance.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'scene/3d') 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 Spatial::get_world() const { ERR_FAIL_COND_V(!is_inside_world(), Ref()); + ERR_FAIL_COND_V(!data.viewport, Ref()); + return data.viewport->find_world(); } diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 99c86f0406..4808470800 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -60,7 +60,7 @@ void VisualInstance::_notification(int p_what) { if (skeleton) VisualServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() ); */ - + ERR_FAIL_COND(get_world().is_null()); VisualServer::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario()); _update_visibility(); -- cgit v1.2.3