Skip to content

Commit 2b36b05

Browse files
committed
fix: ensure public get config overload is used
1 parent 11e9d1a commit 2b36b05

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/behaviortree_cpp/flatbuffers/bt_flatbuffer_helper.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ inline void CreateFlatbuffersBehaviorTree(flatbuffers::FlatBufferBuilder& builde
8080
children_uid.push_back(child->UID());
8181
}
8282

83+
// Const cast to ensure public access to config() overload
84+
const auto& node_config = const_cast<BT::TreeNode const &>(*node).config();
8385
std::vector<flatbuffers::Offset<Serialization::PortConfig>> ports;
84-
for (const auto& it : node->config().input_ports)
86+
for (const auto& it : node_config.input_ports)
8587
{
8688
ports.push_back(Serialization::CreatePortConfigDirect(builder, it.first.c_str(),
8789
it.second.c_str()));
8890
}
89-
for (const auto& it : node->config().output_ports)
91+
for (const auto& it : node_config.output_ports)
9092
{
9193
ports.push_back(Serialization::CreatePortConfigDirect(builder, it.first.c_str(),
9294
it.second.c_str()));

0 commit comments

Comments
 (0)