@@ -127,7 +127,7 @@ hConstraint Constraint::ConstrainCoincident(hEntity ptA, hEntity ptB) {
127127 Entity::NO_ENTITY, Entity::NO_ENTITY, /* other=*/ false , /* other2=*/ false );
128128}
129129
130- void Constraint::ConstrainArcLineTangent (Constraint *c, Entity *line, Entity *arc) {
130+ bool Constraint::ConstrainArcLineTangent (Constraint *c, Entity *line, Entity *arc) {
131131 Vector l0 = SK.GetEntity (line->point [0 ])->PointGetNum (),
132132 l1 = SK.GetEntity (line->point [1 ])->PointGetNum ();
133133 Vector a1 = SK.GetEntity (arc->point [1 ])->PointGetNum (),
@@ -140,11 +140,12 @@ void Constraint::ConstrainArcLineTangent(Constraint *c, Entity *line, Entity *ar
140140 Error (_ (" The tangent arc and line segment must share an "
141141 " endpoint. Constrain them with Constrain -> "
142142 " On Point before constraining tangent." ));
143- return ;
143+ return false ;
144144 }
145+ return true ;
145146}
146147
147- void Constraint::ConstrainCubicLineTangent (Constraint *c, Entity *line, Entity *cubic) {
148+ bool Constraint::ConstrainCubicLineTangent (Constraint *c, Entity *line, Entity *cubic) {
148149 Vector l0 = SK.GetEntity (line->point [0 ])->PointGetNum (),
149150 l1 = SK.GetEntity (line->point [1 ])->PointGetNum ();
150151 Vector as = cubic->CubicGetStartNum (),
@@ -158,11 +159,12 @@ void Constraint::ConstrainCubicLineTangent(Constraint *c, Entity *line, Entity *
158159 Error (_ (" The tangent cubic and line segment must share an "
159160 " endpoint. Constrain them with Constrain -> "
160161 " On Point before constraining tangent." ));
161- return ;
162+ return false ;
162163 }
164+ return true ;
163165}
164166
165- void Constraint::ConstrainCurveCurveTangent (Constraint *c, Entity *eA, Entity *eB) {
167+ bool Constraint::ConstrainCurveCurveTangent (Constraint *c, Entity *eA, Entity *eB) {
166168 Vector as = eA->EndpointStart (),
167169 af = eA->EndpointFinish (),
168170 bs = eB->EndpointStart (),
@@ -183,8 +185,9 @@ void Constraint::ConstrainCurveCurveTangent(Constraint *c, Entity *eA, Entity *e
183185 Error (_ (" The curves must share an endpoint. Constrain them "
184186 " with Constrain -> On Point before constraining "
185187 " tangent." ));
186- return ;
188+ return false ;
187189 }
190+ return true ;
188191}
189192
190193void Constraint::MenuConstrain (Command id) {
@@ -690,7 +693,9 @@ void Constraint::MenuConstrain(Command id) {
690693 if (line->type == Entity::Type::ARC_OF_CIRCLE) {
691694 swap (line, arc);
692695 }
693- ConstrainArcLineTangent (&c, line, arc);
696+ if (!ConstrainArcLineTangent (&c, line, arc)) {
697+ return ;
698+ }
694699 c.type = Type::ARC_LINE_TANGENT;
695700 c.entityA = arc->h ;
696701 c.entityB = line->h ;
@@ -700,7 +705,9 @@ void Constraint::MenuConstrain(Command id) {
700705 if (line->type == Entity::Type::CUBIC) {
701706 swap (line, cubic);
702707 }
703- ConstrainCubicLineTangent (&c, line, cubic);
708+ if (!ConstrainCubicLineTangent (&c, line, cubic)) {
709+ return ;
710+ }
704711 c.type = Type::CUBIC_LINE_TANGENT;
705712 c.entityA = cubic->h ;
706713 c.entityB = line->h ;
@@ -711,7 +718,9 @@ void Constraint::MenuConstrain(Command id) {
711718 }
712719 Entity *eA = SK.GetEntity (gs.entity [0 ]),
713720 *eB = SK.GetEntity (gs.entity [1 ]);
714- ConstrainCurveCurveTangent (&c, eA, eB);
721+ if (!ConstrainCurveCurveTangent (&c, eA, eB)) {
722+ return ;
723+ }
715724 c.type = Type::CURVE_CURVE_TANGENT;
716725 c.entityA = eA->h ;
717726 c.entityB = eB->h ;
0 commit comments