Skip to content

Commit

Permalink
fix crash with null pointer links
Browse files Browse the repository at this point in the history
in PropertyLinkList handle case with null pointers as value
in STEP reader avoid to create coumpound objects with null pointer links
  • Loading branch information
wwmayer committed Jan 30, 2017
1 parent 3a3fa30 commit bcea759
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/App/PropertyLinks.cpp
Expand Up @@ -291,8 +291,14 @@ void PropertyLinkList::Save(Base::Writer &writer) const
{
writer.Stream() << writer.ind() << "<LinkList count=\"" << getSize() << "\">" << endl;
writer.incInd();
for (int i = 0; i<getSize(); i++)
writer.Stream() << writer.ind() << "<Link value=\"" << _lValueList[i]->getNameInDocument() << "\"/>" << endl;;
for (int i = 0; i<getSize(); i++) {
DocumentObject* obj = _lValueList[i];
if (obj)
writer.Stream() << writer.ind() << "<Link value=\"" << obj->getNameInDocument() << "\"/>" << endl;
else
writer.Stream() << writer.ind() << "<Link value=\"\"/>" << endl;
}

writer.decInd();
writer.Stream() << writer.ind() << "</LinkList>" << endl;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Import/App/ImportOCAF.cpp
Expand Up @@ -211,10 +211,10 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
loadShapes(it.Value(), part_loc, part_name, asm_name, isRef, localValue);
}

if (pcCompound)
if (pcCompound) {
pcCompound->Links.setValues(localValue);

lValue.push_back(pcCompound);
lValue.push_back(pcCompound);
}
}
}
}
Expand Down

0 comments on commit bcea759

Please sign in to comment.