Skip to content

Commit 23225af

Browse files
committed
Slightly cleanup link.cpp.
Just make the code flow easier to understand. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
1 parent 9549c51 commit 23225af

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

urdf_parser/src/link.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,14 @@ bool parseLink(Link &link, TiXmlElement* config)
485485

486486
VisualSharedPtr vis;
487487
vis.reset(new Visual());
488-
if (parseVisual(*vis, vis_xml))
489-
{
490-
link.visual_array.push_back(vis);
491-
}
492-
else
488+
if (!parseVisual(*vis, vis_xml))
493489
{
494490
vis.reset();
495491
CONSOLE_BRIDGE_logError("Could not parse visual element for Link [%s]", link.name.c_str());
496492
return false;
497493
}
494+
495+
link.visual_array.push_back(vis);
498496
}
499497

500498
// Visual (optional)
@@ -507,16 +505,13 @@ bool parseLink(Link &link, TiXmlElement* config)
507505
{
508506
CollisionSharedPtr col;
509507
col.reset(new Collision());
510-
if (parseCollision(*col, col_xml))
511-
{
512-
link.collision_array.push_back(col);
513-
}
514-
else
508+
if (!parseCollision(*col, col_xml))
515509
{
516510
col.reset();
517511
CONSOLE_BRIDGE_logError("Could not parse collision element for Link [%s]", link.name.c_str());
518512
return false;
519513
}
514+
link.collision_array.push_back(col);
520515
}
521516

522517
// Collision (optional)

0 commit comments

Comments
 (0)