Skip to content

Commit

Permalink
renamed variable
Browse files Browse the repository at this point in the history
Signed-off-by: Jenn Nguyen <[email protected]>
  • Loading branch information
jennuine committed Jul 22, 2022
1 parent a1d294d commit c86f6d1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -964,14 +964,14 @@ namespace ignition
return false;
}

// Get the top level <model> element.
tinyxml2::XMLElement *modelElement = modelConfigDoc.FirstChildElement(
// Get the top level <model> or <world> element.
tinyxml2::XMLElement *topElement = modelConfigDoc.FirstChildElement(
"model");
bool isModel = true;
if (!modelElement)
if (!topElement)
{
modelElement = modelConfigDoc.FirstChildElement("world");
if (!modelElement)
topElement = modelConfigDoc.FirstChildElement("world");
if (!topElement)
{
std::cerr << "Model config string does not contain a "
<< "<model> or <world> element\n";
Expand All @@ -981,7 +981,7 @@ namespace ignition
}

// Read the name, which is a mandatory element.
tinyxml2::XMLElement *elem = modelElement->FirstChildElement("name");
tinyxml2::XMLElement *elem = topElement->FirstChildElement("name");
if (!elem || !elem->GetText())
{
std::cerr << "Model config string does not contain a <name> element\n";
Expand All @@ -990,20 +990,20 @@ namespace ignition
meta.set_name(trimmed(elem->GetText()));

// Read the version, if present.
elem = modelElement->FirstChildElement("version");
elem = topElement->FirstChildElement("version");
if (elem && elem->GetText())
{
auto version = std::stoi(trimmed(elem->GetText()));
meta.set_version(version);
}

// Read the description, if present.
elem = modelElement->FirstChildElement("description");
elem = topElement->FirstChildElement("description");
if (elem && elem->GetText())
meta.set_description(trimmed(elem->GetText()));

// Read the dependencies, if any.
elem = modelElement->FirstChildElement("depend");
elem = topElement->FirstChildElement("depend");
while (elem)
{
auto modelElem = elem->FirstChildElement("model");
Expand All @@ -1020,7 +1020,7 @@ namespace ignition
}

// Read the authors, if any.
elem = modelElement->FirstChildElement("author");
elem = topElement->FirstChildElement("author");
while (elem)
{
ignition::msgs::FuelMetadata::Contact *author = meta.add_authors();
Expand All @@ -1041,7 +1041,7 @@ namespace ignition
}

// Get the most recent SDF file
elem = modelElement->FirstChildElement("sdf");
elem = topElement->FirstChildElement("sdf");
math::SemanticVersion maxVer;
while (elem)
{
Expand Down

0 comments on commit c86f6d1

Please sign in to comment.