Skip to content

Segmentation fault when substituting subtree #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Isarm opened this issue Feb 14, 2025 · 0 comments
Open

Segmentation fault when substituting subtree #934

Isarm opened this issue Feb 14, 2025 · 0 comments

Comments

@Isarm
Copy link
Contributor

Isarm commented Feb 14, 2025

Describe the bug
Trying to add a substitution rule on a subtree results in a segmentation fault. Segfault happens inside factory.createTree()

How to Reproduce

TEST(MinimalExampleTest, minimalExampleTest) {
  BT::BehaviorTreeFactory factory;
  // Find all the XML files in a folder and register all of them.
  // We will use std::filesystem::directory_iterator
  using std::filesystem::directory_iterator;
  for (auto const& entry : directory_iterator(BT_TREES_PATH)) {
    if (entry.path().extension() == ".xml") {
      factory.registerBehaviorTreeFromFile(entry.path().string());
    }
  }
  BT::TestNodeConfig config;
  factory.addSubstitutionRule("child", config);

  BT::Tree tree = factory.createTree("Parent");
}

With these 2 trees inside BT_TREES_PATH:

<root BTCPP_format="4">
  <BehaviorTree ID="Parent" name="parent">
    <SubTree ID="ChildTree" name="child" />
  </BehaviorTree>
</root>
<root BTCPP_format="4">
  <BehaviorTree ID="Child">
    <AlwaysSuccess />
  </BehaviorTree>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant