Skip to content

Commit 43e8c21

Browse files
committed
issue #2816: Trimming tool crashes
1 parent 417f074 commit 43e8c21

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Mod/Sketcher/App/PropertyConstraintList.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ class SketcherExport PropertyConstraintList : public App::PropertyLists
8686
*/
8787
void setValues(const std::vector<Constraint*>&);
8888

89-
/// index operator
89+
/*!
90+
Index operator
91+
\note If the geometry is invalid then the index operator
92+
returns null. This must be checked by the caller.
93+
*/
9094
const Constraint *operator[] (const int idx) const {
9195
return invalidGeometry ? 0 : _lValueList[idx];
9296
}
@@ -112,7 +116,6 @@ class SketcherExport PropertyConstraintList : public App::PropertyLists
112116
void acceptGeometry(const std::vector<Part::Geometry *> &GeoList);
113117
void checkGeometry(const std::vector<Part::Geometry *> &GeoList);
114118
bool scanGeometry(const std::vector<Part::Geometry *> &GeoList) const;
115-
bool isGeometryInvalid(){return invalidGeometry;}
116119

117120
/// Return status of geometry for better error reporting
118121
bool hasInvalidGeometry() const { return invalidGeometry; }

src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ class ConstraintItem : public QListWidgetItem
102102

103103
const Sketcher::Constraint * constraint = sketch->Constraints[ConstraintNbr];
104104

105+
// it can happen that the geometry of the sketch is tmp. invalid and thus
106+
// the index operator returns null.
107+
if (!constraint) {
108+
return QVariant();
109+
}
110+
105111
if (role == Qt::EditRole) {
106112
if (value.isValid())
107113
return value;

0 commit comments

Comments
 (0)