Fix a crash when adding a symmetric constraint on a line.

This is the same problem as in ffd9c62.
This commit is contained in:
whitequark 2016-11-16 02:19:09 +00:00
parent a0d7f1dadb
commit 9673225648

View File

@ -379,9 +379,13 @@ void Constraint::MenuConstrain(Command id) {
((gs.workplanes == 1 && gs.n == 2) || ((gs.workplanes == 1 && gs.n == 2) ||
(gs.n == 1))) (gs.n == 1)))
{ {
int i = SK.GetEntity(gs.entity[0])->IsWorkplane() ? 1 : 0; Entity *line;
Entity *line = SK.GetEntity(gs.entity[i]); if(SK.GetEntity(gs.entity[0])->IsWorkplane()) {
c.entityA = gs.entity[1-i]; line = SK.GetEntity(gs.entity[1]);
c.entityA = gs.entity[0];
} else {
line = SK.GetEntity(gs.entity[0]);
}
c.ptA = line->point[0]; c.ptA = line->point[0];
c.ptB = line->point[1]; c.ptB = line->point[1];
c.type = Type::SYMMETRIC; c.type = Type::SYMMETRIC;