Added check for SceneTree being null

(cherry picked from commit 51501dadcc)
This commit is contained in:
vitika9 2021-12-13 14:25:52 +05:30 committed by Rémi Verschelde
parent 4f38a9e4d6
commit e88f387958
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -362,6 +362,10 @@ void Viewport::_notification(int p_what) {
VS::get_singleton()->viewport_set_active(viewport, false);
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (!get_tree()) {
return;
}
if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) {
VisualServer::get_singleton()->canvas_item_clear(contact_2d_debug);
VisualServer::get_singleton()->canvas_item_set_draw_index(contact_2d_debug, 0xFFFFF); //very high index