Issue ID 0004230 : Fixing a crash in chamfer command. Putting a null check for the function return value

[skip ci]
This commit is contained in:
Rajendra Pardeshi
2019-12-26 23:38:24 +05:30
committed by wmayer
parent ae7ebde4e3
commit 28d67eba2e
2 changed files with 5 additions and 3 deletions

View File

@@ -786,7 +786,8 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop
&& d->_editingObject
&& d->_editViewProviderParent
&& (Prop.isDerivedFrom(App::PropertyPlacement::getClassTypeId())
|| strstr(Prop.getName(),"Scale"))
// Issue ID 0004230 : getName() can return null in which case strstr() crashes
|| (Prop.getName() && strstr(Prop.getName(),"Scale")))
&& d->_editObjs.count(&Obj))
{
Base::Matrix4D mat;

View File

@@ -723,8 +723,9 @@ void CmdSketcherMirrorSketch::activated(int iMsg)
std::vector<Part::Geometry *> tempgeo = tempsketch->getInternalGeometry();
std::vector<Sketcher::Constraint *> tempconstr = tempsketch->Constraints.getValues();
std::vector<Part::Geometry *> mirrorgeo (tempgeo.begin()+addedGeometries+1,tempgeo.end());
std::vector<Sketcher::Constraint *> mirrorconstr (tempconstr.begin()+addedConstraints+1,tempconstr.end());
// If value of addedGeometries or addedConstraints is -1, it gets added to vector begin iterator and that is invlid
std::vector<Part::Geometry *> mirrorgeo(tempgeo.begin() + (addedGeometries + 1), tempgeo.end());
std::vector<Sketcher::Constraint *> mirrorconstr(tempconstr.begin() + (addedConstraints + 1), tempconstr.end());
for (std::vector<Sketcher::Constraint *>::const_iterator itc=mirrorconstr.begin(); itc != mirrorconstr.end(); ++itc) {