Skip to content

Commit

Permalink
Fixes a segfault in toggle floor plugin which causes ignition to cras…
Browse files Browse the repository at this point in the history
…h when scene is not ready. (#78)

This PR fixes a segfault I have been experiencing when loading large worlds. Often the rendering scene is not fully setup causing the` this->scene->NodeByName` to crash. This PR pushes a simple fix to skip over scenarios where the scene has not yet loaded the model.

Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
  • Loading branch information
arjo129 committed Aug 22, 2022
1 parent bcd186d commit 98e19e9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ void toggle_floors::PerformRenderingOperations()
for (const std::string& model : models)
{
auto target_node = this->scene->NodeByName(model);
if (target_node == NULL)
{
ignwarn << "Node for " << model << "was not found" <<std::endl;
continue;
}
auto target_vis =
std::dynamic_pointer_cast<ignition::rendering::Visual>(target_node);
target_vis->SetVisible(_floor_visibility[floor_name]);
Expand Down

0 comments on commit 98e19e9

Please sign in to comment.