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 21, 2023
1 parent 0e9b0be commit e029104
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 @@ -2501,7 +2501,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 e029104

Please sign in to comment.