From fba5a4ab9ac606c3ecbae638c369cea546e8e23a Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 28 Sep 2022 15:49:26 +0800 Subject: [PATCH] Fix NavigationObstacle not registering to default navigation map --- scene/2d/navigation_obstacle_2d.cpp | 2 +- scene/3d/navigation_obstacle.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 }