From ffd9c6241a54fc5daf734f6b0d8e73267ec99cee Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 28 Aug 2016 16:50:36 +0000 Subject: [PATCH] Fix a crash when adding a symmetric constraint on two points. The crash was introduced in e2e91672; I have not noticed that some of the code relies on past-the-size entities in GW.GS being empty. --- src/constraint.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/constraint.cpp b/src/constraint.cpp index 9681542..23cee25 100644 --- a/src/constraint.cpp +++ b/src/constraint.cpp @@ -370,7 +370,8 @@ void Constraint::MenuConstrain(Command id) { ((gs.workplanes == 1 && gs.n == 3) || (gs.n == 2))) { - c.entityA = gs.entity[0]; + if(gs.entities > 0) + c.entityA = gs.entity[0]; c.ptA = gs.point[0]; c.ptB = gs.point[1]; c.type = Type::SYMMETRIC;