summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorTrashtalk <Trashtalk217@gmail.com>2022-09-07 00:05:56 +0200
committerTrashtalk <Trashtalk217@gmail.com>2022-09-07 00:05:56 +0200
commit1d233ce58cdcd4ad155a014cc7e7928057a1d8c9 (patch)
tree5e972fbb9ac496ae228870cfcb495a890c50a47c /scene/2d
parent432c4c40a9d29c127a5957944ca8f805dfb836ce (diff)
handled edge case where navigation_link_2d is outside of the tree when calling _edit_get_rect()
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/navigation_link_2d.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/2d/navigation_link_2d.cpp b/scene/2d/navigation_link_2d.cpp
index 38a03aaf97..8ba51482ee 100644
--- a/scene/2d/navigation_link_2d.cpp
+++ b/scene/2d/navigation_link_2d.cpp
@@ -113,6 +113,10 @@ void NavigationLink2D::_notification(int p_what) {
#ifdef TOOLS_ENABLED
Rect2 NavigationLink2D::_edit_get_rect() const {
+ if (!is_inside_tree()) {
+ return Rect2();
+ }
+
real_t radius = NavigationServer2D::get_singleton()->map_get_link_connection_radius(get_world_2d()->get_navigation_map());
Rect2 rect(get_start_location(), Size2());