Skip to content

Commit

Permalink
fix two of three seg faults
Browse files Browse the repository at this point in the history
Signed-off-by: frederik <[email protected]>
  • Loading branch information
fredmarkus committed Jan 13, 2024
1 parent 6911db6 commit f4962c0
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions graphics/src/ColladaLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2241,11 +2241,21 @@ void ColladaLoader::Implementation::LoadPolylist(
std::string offset = polylistInputXml->Attribute("offset");
if (semantic == "VERTEX")
{
unsigned int count = (*norms).size();
unsigned int count;
if (!norms || norms->empty())
count = 0;
else
count = (*norms).size();

this->LoadVertices(source, _transform, verts, norms,
positionDupMap, normalDupMap);
if ((*norms).size() > count)
combinedVertNorms = true;

if (norms && !norms->empty())
{
if ((*norms).size() > count)
combinedVertNorms = true;
}

inputs[VERTEX].insert(gz::math::parseInt(offset));
}
else if (semantic == "NORMAL")
Expand Down Expand Up @@ -2581,22 +2591,17 @@ void ColladaLoader::Implementation::LoadTriangles(
{
unsigned int count;
if (!norms || norms->empty())
{
count = 0;
}
else
{
count = (*norms).size();
}

this->LoadVertices(source, _transform, verts, norms,
positionDupMap, normalDupMap);

if (norms && !norms->empty())
{
if ((*norms).size() > count)
{
combinedVertNorms = true;
}
}
inputs[VERTEX].insert(gz::math::parseInt(offset));
hasVertices = true;
Expand All @@ -2610,9 +2615,7 @@ void ColladaLoader::Implementation::LoadTriangles(
if (norms && !norms->empty())
{
if ((*norms).size() > 0)
{
hasNormals = true;
}
}
}
else if (semantic == "TEXCOORD")
Expand Down

0 comments on commit f4962c0

Please sign in to comment.