Skip to content

Commit

Permalink
[TD]fix crash on dim create on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Jan 19, 2023
1 parent 72df799 commit 7fc59a6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Mod/TechDraw/Gui/DimensionValidators.cpp
Expand Up @@ -119,21 +119,27 @@ DimensionGeometryType TechDraw::validateDimSelection(
TechDraw::DrawViewPart* dvp = dynamic_cast<TechDraw::DrawViewPart*>(ref.getObject());
if (dvp) {
dvpSave = dvp;
//TODO: check for non-empty subname?
subNames.push_back(ref.getSubName());
if (!ref.getSubName().empty()) {
subNames.push_back(ref.getSubName());
}
}
}
if (!dvpSave) {
//must have 1 DVP in selection
return isInvalid;
}

if (subNames.front().empty()) {
if (subNames.empty()) {
//no geometry referenced. can not make a dim from this mess. We are being called to validate
//a selection for a 3d reference
return isViewReference;
}

if (subNames.front().empty()) {
//can this still happen?
return isViewReference;
}

//check for invalid geometry descriptors in the subNames
std::unordered_set<std::string> acceptableGeometrySet(acceptableGeometry.begin(),
acceptableGeometry.end());
Expand Down Expand Up @@ -237,11 +243,11 @@ bool TechDraw::checkGeometryOccurences(StringVector subNames, GeomCountMap keyed
std::string geometryType = DrawUtil::getGeomTypeFromName(sub);
std::map<std::string, int>::iterator it0(foundCounts.find(geometryType));
if (it0 == foundCounts.end()) {
//already have this geometryType
it0->second++;
} else {
//first occurrence of this geometryType
foundCounts[geometryType] = 1;
} else {
//already have this geometryType
it0->second++;
}
}

Expand Down

0 comments on commit 7fc59a6

Please sign in to comment.