fix crash with null pointer links

in PropertyLinkList handle case with null pointers as value
in STEP reader avoid to create coumpound objects with null pointer links
This commit is contained in:
wmayer 2017-01-30 16:47:31 +01:00
parent 3a3fa30595
commit bcea759287
2 changed files with 11 additions and 5 deletions

View File

@ -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;
}

View File

@ -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);
}
}
}
}