Skip to content

Commit

Permalink
Mesh: Fix crash MeshPy::setPoint & MeshPy::movePoint
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jan 2, 2025
1 parent e977eb4 commit c584734
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Mod/Mesh/App/MeshPyImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,13 @@ PyObject* MeshPy::setPoint(PyObject* args)

PY_TRY
{
getMeshObjectPtr()->setPoint(index, static_cast<Base::VectorPy*>(pnt)->value());
MeshObject* mesh = getMeshObjectPtr();
if (index >= mesh->countPoints()) {
Base::IndexError exc("index out of range");
exc.setPyException();
return nullptr;
}
mesh->setPoint(index, static_cast<Base::VectorPy*>(pnt)->value());
}
PY_CATCH;

Expand Down Expand Up @@ -935,7 +941,14 @@ PyObject* MeshPy::movePoint(PyObject* args)
return nullptr;
} while (false);

getMeshObjectPtr()->movePoint(index, vec);
MeshObject* mesh = getMeshObjectPtr();
if (index >= mesh->countPoints()) {
Base::IndexError exc("index out of range");
exc.setPyException();
return nullptr;
}

mesh->movePoint(index, vec);
Py_Return;
}

Expand Down

0 comments on commit c584734

Please sign in to comment.