Skip to content

Commit

Permalink
0001714: FreeCAD 0.14 Stable crashes when importing a step model
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 2, 2014
1 parent 3ecaf87 commit f25e6e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Gui/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,19 @@ void ObjectLabelObserver::slotRelabelObject(const App::DocumentObject& obj, cons
}

// make sure that there is a name conflict otherwise we don't have to do anything
if (match) {
if (match && !label.empty()) {
// remove number from end to avoid lengthy names
size_t lastpos = label.length()-1;
while (label[lastpos] >= 48 && label[lastpos] <= 57)
while (label[lastpos] >= 48 && label[lastpos] <= 57) {
// if 'lastpos' becomes 0 then all characters are digits. In this case we use
// the complete label again
if (lastpos == 0) {
lastpos = label.length()-1;
break;
}
lastpos--;
}

label = label.substr(0, lastpos+1);
label = Base::Tools::getUniqueName(label, objectLabels, 3);
this->current = &obj;
Expand Down

0 comments on commit f25e6e4

Please sign in to comment.