Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketcher: Add a guard for not asking information of a point of a curve which doesn't exist #13802

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
namespace SketcherGui
{

extern GeometryCreationMode geometryCreationMode; // defined in CommandCreateGeo.cpp

Check warning on line 49 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

variable 'geometryCreationMode' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

Check warning on line 49 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

redundant 'geometryCreationMode' declaration [readability-redundant-declaration]

class DrawSketchHandlerArc;

Expand All @@ -65,7 +65,7 @@

using DrawSketchHandlerArcBase = DrawSketchControllableHandler<DSHArcController>;

class DrawSketchHandlerArc: public DrawSketchHandlerArcBase

Check warning on line 68 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

class 'DrawSketchHandlerArc' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions]
{
friend DSHArcController;
friend DSHArcControllerBase;
Expand All @@ -84,7 +84,7 @@
~DrawSketchHandlerArc() override = default;

private:
void updateDataAndDrawToPosition(Base::Vector2d onSketchPos) override

Check warning on line 87 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

function 'updateDataAndDrawToPosition' has cognitive complexity of 56 (threshold 25) [readability-function-cognitive-complexity]
{
switch (state()) {
case SelectMode::SeekFirst: {
Expand Down Expand Up @@ -465,8 +465,8 @@
void DSHArcController::configureToolWidget()
{
if (!init) { // Code to be executed only upon initialisation
QStringList names = {QApplication::translate("Sketcher_CreateArc", "Center"),

Check failure on line 468 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

incomplete type 'QApplication' named in nested name specifier

Check failure on line 468 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

incomplete type 'QApplication' named in nested name specifier [clang-diagnostic-error]
QApplication::translate("Sketcher_CreateArc", "3 rim points")};

Check failure on line 469 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

incomplete type 'QApplication' named in nested name specifier

Check failure on line 469 in src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

incomplete type 'QApplication' named in nested name specifier [clang-diagnostic-error]
toolWidget->setComboboxElements(WCombobox::FirstCombo, names);

if (isConstructionMode()) {
Expand Down Expand Up @@ -833,6 +833,12 @@
}
}
else { // Valid diagnosis. Must check which constraints may be added.

// if no curve exists a crash occurs #12755
if (firstCurve < 0) {
return;
}

auto startpointinfo = handler->getPointInfo(GeoElementId(firstCurve, pos1));

if (x0set && startpointinfo.isXDoF()) {
Expand Down