From 6bd43e35bbb9ba19ea70a6d4e496480d6ec4dcde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Sun, 5 Apr 2020 00:27:30 +0200 Subject: [PATCH] Fix bug in structure.find() --- include/core/state_block/has_state_blocks.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/core/state_block/has_state_blocks.h b/include/core/state_block/has_state_blocks.h index e9e922351..958b4f199 100644 --- a/include/core/state_block/has_state_blocks.h +++ b/include/core/state_block/has_state_blocks.h @@ -25,7 +25,7 @@ class HasStateBlocks const StateStructure& getStructure() const { return structure_; } void appendToStructure(const std::string& _frame_type){ structure_ += _frame_type; } - bool isInStructure(const std::string& _sb_type) { return structure_.find(_sb_type); } + bool isInStructure(const std::string& _sb_type) { return structure_.find(_sb_type) != std::string::npos; } const std::unordered_map<std::string, StateBlockPtr>& getStateBlockMap() const; std::vector<StateBlockPtr> getStateBlockVec() const; @@ -156,7 +156,7 @@ inline StateBlockPtr HasStateBlocks::emplaceStateBlock(const std::string& _sb_ty inline bool HasStateBlocks::setStateBlock(const std::string _sb_type, const StateBlockPtr& _sb) { - assert (structure_.find(_sb_type) && "Cannot set a state block out of the state structure! Use addStateBlock instead."); + assert (structure_.find(_sb_type) != std::string::npos && "Cannot set a state block out of the state structure! Use addStateBlock instead."); assert ( state_block_map_.count(_sb_type) > 0 && "Cannot set an inexistent state block! Use addStateBlock instead."); state_block_map_.at(_sb_type) = _sb; return true; // success -- GitLab