Apply suggestions from code review

This commit is contained in:
Chris Hennes
2024-03-04 19:01:18 -06:00
committed by GitHub
parent 834bbff6b0
commit 84e0cc7293
2 changed files with 6 additions and 4 deletions

View File

@@ -1379,14 +1379,14 @@ void ElementMap::traceElement(const MappedName& name, long masterTag, TraceCallb
MappedName tmp;
bool first = true;
// TODO: element tracing without object is inheriently unsafe, because of
// TODO: element tracing without object is inherently unsafe, because of
// possible external linking object which means the element may be encoded
// using external string table. Looking up the wrong table may accidentally
// cause circular mapping, and is actually quite easy to reproduce. See
//
// https://github.com/realthunder/FreeCAD_assembly3/issues/968
//
// A random depth limit is set here to not waste time. 'tagSet' above is
// An arbitrary depth limit is set here to not waste time. 'tagSet' above is
// also used for early detection of 'recursive' mapping.
for (int index = 0; index < 50; ++index) {

View File

@@ -5014,11 +5014,13 @@ bool TopoShape::getRelatedElementsCached(const Data::MappedName &name,
HistoryTraceType sameType,
QVector<Data::MappedElement> &names) const
{
if(!_cache)
if(!_cache) {
return false;
}
auto it = _cache->relations.find(ShapeRelationKey(name,sameType));
if(it == _cache->relations.end())
if(it == _cache->relations.end()) {
return false;
}
names = it->second;
return true;
}