diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index c5ac9b33e2a..2a8555d3621 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -134,7 +134,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 1376a08d521..027f803905c 100644 --- a/scene/3d/navigation_obstacle.cpp +++ b/scene/3d/navigation_obstacle.cpp @@ -140,7 +140,7 @@ NavigationObstacle::~NavigationObstacle() { } void NavigationObstacle::set_navigation(Navigation *p_nav) { - if (navigation == p_nav) { + if (navigation == p_nav && navigation != nullptr) { return; // Pointless }