fix crashes when aborting linear pattern panel due access of null pointers

This commit is contained in:
wmayer
2017-09-29 21:22:48 +02:00
parent 9beb6f2029
commit 3b1c433daa
2 changed files with 14 additions and 7 deletions

View File

@@ -248,15 +248,19 @@ void TaskLinearPatternParameters::onSelectionChanged(const Gui::SelectionChanges
// TODO check if this works correctly (2015-09-01, Fat-Zer)
exitSelectionMode();
std::vector<std::string> directions;
App::DocumentObject* selObj;
App::DocumentObject* selObj = nullptr;
PartDesign::LinearPattern* pcLinearPattern = static_cast<PartDesign::LinearPattern*>(getObject());
getReferencedSelection(pcLinearPattern, msg, selObj, directions);
// Note: ReferenceSelection has already checked the selection for validity
if ( selectionMode == reference || selObj->isDerivedFrom ( App::Line::getClassTypeId () ) ) {
pcLinearPattern->Direction.setValue(selObj, directions);
if (pcLinearPattern) {
getReferencedSelection(pcLinearPattern, msg, selObj, directions);
recomputeFeature();
updateUI();
// Note: ReferenceSelection has already checked the selection for validity
if (selObj && (selectionMode == reference ||
selObj->isDerivedFrom(App::Line::getClassTypeId()))) {
pcLinearPattern->Direction.setValue(selObj, directions);
recomputeFeature();
updateUI();
}
}
}
}