diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index 452e4cf11..f20564c20 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -135,7 +135,7 @@ NavigationObstacle2D::~NavigationObstacle2D() { } void NavigationObstacle2D::set_navigation(Navigation2D *p_nav) { - if (navigation == p_nav) { + if (navigation == p_nav && navigation != nullptr) { return; // Pointless } diff --git a/scene/3d/navigation_obstacle.cpp b/scene/3d/navigation_obstacle.cpp index 8c7875835..843f72f23 100644 --- a/scene/3d/navigation_obstacle.cpp +++ b/scene/3d/navigation_obstacle.cpp @@ -142,7 +142,7 @@ NavigationObstacle::~NavigationObstacle() { } void NavigationObstacle::set_navigation(Navigation *p_nav) { - if (navigation == p_nav) { + if (navigation == p_nav && navigation != nullptr) { return; // Pointless }