From 8668d48b2da6d6562566ca464c137cd50d9b28f2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jul 2024 19:26:23 +0200 Subject: [PATCH] Sketch: Fix compiler warnings --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index f860213996..224b5567d8 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1492,12 +1492,13 @@ public: if (cstrIndexes.size() > 0) { bool oneMoved = false; const std::vector& ConStr = Obj->Constraints.getValues(); + int lastConstrIndex = static_cast(ConStr.size()) - 1; for (int index : cstrIndexes) { if (ConStr[index]->isDimensional()) { Base::Vector2d pointWhereToMove = onSketchPos; if (specialConstraint == SpecialConstraint::Block) { - if (index == ConStr.size() - 1) + if (index == lastConstrIndex) pointWhereToMove.y = Obj->getPoint(selPoints[0].GeoId, selPoints[0].PosId).y; else pointWhereToMove.x = Obj->getPoint(selPoints[0].GeoId, selPoints[0].PosId).x; @@ -2689,8 +2690,9 @@ protected: bool hasBeenAborted() { // User can abort the command with Undo (ctrl-Z) - if (cstrIndexes.size() > 0) { - if (cstrIndexes.back() != Obj->Constraints.getValues().size() - 1 ) { + if (!cstrIndexes.empty()) { + int lastConstrIndex = Obj->Constraints.getSize() - 1; + if (cstrIndexes.back() != lastConstrIndex) { return true; } }