Commit 5a5abdec authored by jcarpent's avatar jcarpent

[C++][Fix Bug] Check if the urdf tree pointer is indeed initialized

parent 918d6ddd
build*
Xcode*
......@@ -262,7 +262,13 @@ void parseTree( ::urdf::LinkConstPtr link, Model & model,SE3 placementOffset = S
Model model;
::urdf::ModelInterfacePtr urdfTree = ::urdf::parseURDFFile (filename);
parseTree(urdfTree->getRoot(), model, SE3::Identity(), root_joint);
if (urdfTree)
parseTree(urdfTree->getRoot(), model, SE3::Identity(), root_joint);
else
{
std::cerr << "The URDF tree seems to be empty" << std::endl; // In future, raise exception instead
}
return model;
}
......@@ -271,7 +277,13 @@ void parseTree( ::urdf::LinkConstPtr link, Model & model,SE3 placementOffset = S
Model model;
::urdf::ModelInterfacePtr urdfTree = ::urdf::parseURDFFile (filename);
parseTree(urdfTree->getRoot(), model, SE3::Identity());
if (urdfTree)
parseTree(urdfTree->getRoot(), model, SE3::Identity());
else
{
std::cerr << "The URDF tree seems to be empty" << std::endl; // In future, raise exception instead
}
return model;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment