Skip to content

Commit

Permalink
fix another potential bug of matching substrings with controller name
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Sep 6, 2023
1 parent 133aea7 commit 532d6b3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,11 @@ bool ControllerManager::controller_sorting(
// TODO(saikishor): deal with the state interface chaining in the sorting algorithm
auto state_it = std::find_if(
state_itfs.begin(), state_itfs.end(),
[ctrl_b](auto itf) { return (itf.find(ctrl_b.info.name) != std::string::npos); });
[ctrl_b](auto itf)
{
auto index = itf.find_first_of('/');
return ((index != std::string::npos) && (itf.substr(0, index) == ctrl_b.info.name));
});
if (state_it != state_itfs.end())
{
return false;
Expand Down

0 comments on commit 532d6b3

Please sign in to comment.