PVS: V522 There might be dereferencing of a potential null pointer 'Py::Vector2d().getCxxObject()'

This commit is contained in:
wmayer
2019-02-18 00:00:10 +01:00
parent 34da2b5d4f
commit 5d8cd9dba4
13 changed files with 61 additions and 51 deletions

View File

@@ -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)) {