handle possible crashes with FaceMaker and fix a few coding flaws

This commit is contained in:
wmayer
2016-10-02 14:47:59 +02:00
parent 679bb2f5a8
commit da406cddb8
11 changed files with 48 additions and 28 deletions

View File

@@ -81,8 +81,12 @@ App::DocumentObjectExecReturn *Face::execute(void)
if (links.empty())
return new App::DocumentObjectExecReturn("No shapes linked");
std::unique_ptr<FaceMaker> fm_instance = FaceMaker::ConstructFromType(this->FaceMakerClass.getValue());
FaceMaker* facemaker = &(*(fm_instance));
std::unique_ptr<FaceMaker> facemaker = FaceMaker::ConstructFromType(this->FaceMakerClass.getValue());
if (!facemaker) {
std::stringstream out;
out << "Cannot create FaceMaker from abstract type " << this->FaceMakerClass.getValue();
throw Base::TypeError(out.str());
}
for (std::vector<App::DocumentObject*>::iterator it = links.begin(); it != links.end(); ++it) {
if (!(*it && (*it)->isDerivedFrom(Part::Feature::getClassTypeId())))