Skip to content

Commit

Permalink
BUGFIX: Prevent potential race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Sep 28, 2024
1 parent 1be6d5b commit f4340c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mola_bridge_ros2/src/BridgeROS2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,9 @@ void BridgeROS2::doLookForNewMolaSubs()
}

// Advertise relocalization ROS 2 service now if not done already:
if (!molaSubs_.relocalization.empty() && !srvRelocGNNS_)
auto lckNode = mrpt::lockHelper(rosNodeMtx_);

if (!molaSubs_.relocalization.empty() && !srvRelocGNNS_ && rosNode_)
{
using namespace std::placeholders;

Expand Down Expand Up @@ -956,7 +958,7 @@ void BridgeROS2::doLookForNewMolaSubs()
}

// Advertise map server ROS 2 services now if not done already:
if (!molaSubs_.mapServers.empty() && !srvMapLoad_)
if (!molaSubs_.mapServers.empty() && !srvMapLoad_ && rosNode_)
{
using namespace std::placeholders;

Expand Down

0 comments on commit f4340c6

Please sign in to comment.