PVS: V522 There might be dereferencing of a potential null pointer 'Py::Vector2d().getCxxObject()'
This commit is contained in:
@@ -82,8 +82,8 @@ int Line2dPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
PyObject *pV1, *pV2;
|
||||
if (PyArg_ParseTuple(args, "O!O!", Base::Vector2dPy::type_object(), &pV1,
|
||||
Base::Vector2dPy::type_object(), &pV2)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(pV2).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
Base::Vector2d v2 = Py::toVector2d(pV2);
|
||||
try {
|
||||
// Create line out of two points
|
||||
double distance = (v1-v2).Length();
|
||||
@@ -145,7 +145,7 @@ void Line2dPy::setLocation(Py::Object arg)
|
||||
|
||||
PyObject *p = arg.ptr();
|
||||
if (PyObject_TypeCheck(p, Base::Vector2dPy::type_object())) {
|
||||
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d v = Py::toVector2d(p);
|
||||
pnt.SetX(v.x);
|
||||
pnt.SetY(v.y);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void Line2dPy::setDirection(Py::Object arg)
|
||||
|
||||
PyObject *p = arg.ptr();
|
||||
if (PyObject_TypeCheck(p, Base::Vector2dPy::type_object())) {
|
||||
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d v = Py::toVector2d(p);
|
||||
dir = gp_Dir2d(v.x,v.y);
|
||||
}
|
||||
else if (PyTuple_Check(p)) {
|
||||
|
||||
Reference in New Issue
Block a user