Explorar o código

handled edge case where navigation_link_2d is outside of the tree when calling _edit_get_rect()

Trashtalk %!s(int64=3) %!d(string=hai) anos
pai
achega
1d233ce58c
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      scene/2d/navigation_link_2d.cpp

+ 4 - 0
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());