issue #0002816: Trimming tool crashes

This commit is contained in:
wmayer 2017-01-23 19:06:48 +01:00
parent 417f074aff
commit 43e8c21743
2 changed files with 11 additions and 2 deletions

View File

@ -86,7 +86,11 @@ public:
*/
void setValues(const std::vector<Constraint*>&);
/// index operator
/*!
Index operator
\note If the geometry is invalid then the index operator
returns null. This must be checked by the caller.
*/
const Constraint *operator[] (const int idx) const {
return invalidGeometry ? 0 : _lValueList[idx];
}
@ -112,7 +116,6 @@ public:
void acceptGeometry(const std::vector<Part::Geometry *> &GeoList);
void checkGeometry(const std::vector<Part::Geometry *> &GeoList);
bool scanGeometry(const std::vector<Part::Geometry *> &GeoList) const;
bool isGeometryInvalid(){return invalidGeometry;}
/// Return status of geometry for better error reporting
bool hasInvalidGeometry() const { return invalidGeometry; }

View File

@ -102,6 +102,12 @@ public:
const Sketcher::Constraint * constraint = sketch->Constraints[ConstraintNbr];
// it can happen that the geometry of the sketch is tmp. invalid and thus
// the index operator returns null.
if (!constraint) {
return QVariant();
}
if (role == Qt::EditRole) {
if (value.isValid())
return value;