Skip to content

Commit 7fc59a6

Browse files
committed
[TD]fix crash on dim create on Mac
1 parent 72df799 commit 7fc59a6

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Mod/TechDraw/Gui/DimensionValidators.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,27 @@ DimensionGeometryType TechDraw::validateDimSelection(
119119
TechDraw::DrawViewPart* dvp = dynamic_cast<TechDraw::DrawViewPart*>(ref.getObject());
120120
if (dvp) {
121121
dvpSave = dvp;
122-
//TODO: check for non-empty subname?
123-
subNames.push_back(ref.getSubName());
122+
if (!ref.getSubName().empty()) {
123+
subNames.push_back(ref.getSubName());
124+
}
124125
}
125126
}
126127
if (!dvpSave) {
127128
//must have 1 DVP in selection
128129
return isInvalid;
129130
}
130131

131-
if (subNames.front().empty()) {
132+
if (subNames.empty()) {
132133
//no geometry referenced. can not make a dim from this mess. We are being called to validate
133134
//a selection for a 3d reference
134135
return isViewReference;
135136
}
136137

138+
if (subNames.front().empty()) {
139+
//can this still happen?
140+
return isViewReference;
141+
}
142+
137143
//check for invalid geometry descriptors in the subNames
138144
std::unordered_set<std::string> acceptableGeometrySet(acceptableGeometry.begin(),
139145
acceptableGeometry.end());
@@ -237,11 +243,11 @@ bool TechDraw::checkGeometryOccurences(StringVector subNames, GeomCountMap keyed
237243
std::string geometryType = DrawUtil::getGeomTypeFromName(sub);
238244
std::map<std::string, int>::iterator it0(foundCounts.find(geometryType));
239245
if (it0 == foundCounts.end()) {
240-
//already have this geometryType
241-
it0->second++;
242-
} else {
243246
//first occurrence of this geometryType
244247
foundCounts[geometryType] = 1;
248+
} else {
249+
//already have this geometryType
250+
it0->second++;
245251
}
246252
}
247253

0 commit comments

Comments
 (0)