From a2c97fcd46fa2bb73e9472ed1a1c4158107c4c9d 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 6137021..e078b5c 100644 --- a/src/constraint.cpp +++ b/src/constraint.cpp @@ -370,7 +370,8 @@ void Constraint::MenuConstrain(int 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]; } else if(gs.lineSegments == 1 &&