Fix a null dereference in UrdfParser

When the parser sees no <inertial> tag inside a <deformable>, it logs an error but does not return false. So in the next step, a null pointer is dereferenced.

This can be tested with loading the following URDF:
```
<?xml version="1.0"?>
<robot name="rhythm_carrot_sticks">
  <deformable name="bag">
  </deformable>
</robot>
```
This commit is contained in:
vabr-g
2021-03-01 21:21:11 +01:00
committed by GitHub
parent abea1a8484
commit e4963f73f2

View File

@@ -1132,6 +1132,7 @@ bool UrdfParser::parseDeformable(UrdfModel& model, tinyxml2::XMLElement* config,
if (!i)
{
logger->reportError("expected an inertial element");
return false;
}
UrdfInertia inertia;
if (!parseInertia(inertia, i, logger))