Skip to content

Commit 37d1c99

Browse files
committed
Don't allow keywords 'ID' and 'name' as port name
1 parent 115649a commit 37d1c99

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/behaviortree_cpp_v3/basic_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ std::pair<std::string,PortInfo> CreatePort(PortDirection direction,
265265
StringView name,
266266
StringView description = {})
267267
{
268+
// Don't allow to create "ID" and "name" ports
269+
if (name == "name" || name == "ID") { throw std::runtime_error {"Reserved port keys: \"name\" or \"ID\"! Cannot create port!"}; }
270+
268271
std::pair<std::string,PortInfo> out;
269272

270273
if( std::is_same<T, void>::value)

0 commit comments

Comments
 (0)