From 51501dadcce344ebf83420d93997c9b82ede65f8 Mon Sep 17 00:00:00 2001 From: vitika9 Date: Mon, 13 Dec 2021 14:25:52 +0530 Subject: Added check for SceneTree being null --- scene/main/viewport.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scene/main') 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 -- cgit v1.2.3