summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvitika9 <vitika.program@gmail.com>2021-12-13 14:25:52 +0530
committervitika9 <vitika.program@gmail.com>2021-12-13 15:41:29 +0530
commit51501dadcce344ebf83420d93997c9b82ede65f8 (patch)
tree75f0931f562061612bf7600c363b340c6708637a
parent7f9a82b944724c0228301ded5fbb8efee12eac4d (diff)
Added check for SceneTree being null
-rw-r--r--scene/main/viewport.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 007e5d1173..34845d5875 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -462,6 +462,10 @@ void Viewport::_notification(int p_what) {
RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, RID());
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
+ if (!get_tree()) {
+ return;
+ }
+
if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) {
RenderingServer::get_singleton()->canvas_item_clear(contact_2d_debug);
RenderingServer::get_singleton()->canvas_item_set_draw_index(contact_2d_debug, 0xFFFFF); //very high index