Skip to content

Commit

Permalink
Issue ID 0004230 : Fixing a crash in chamfer command. Putting a null …
Browse files Browse the repository at this point in the history
…check for the function return value

[skip ci]
  • Loading branch information
rajendrasp authored and wwmayer committed Dec 30, 2019
1 parent ae7ebde commit 28d67eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Gui/Document.cpp
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/Mod/Sketcher/Gui/Command.cpp
Expand Up @@ -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) {

Expand Down

0 comments on commit 28d67eb

Please sign in to comment.