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 b842274386
commit 90c80f83fd
13 changed files with 61 additions and 51 deletions

View File

@@ -78,6 +78,16 @@ namespace Py {
typedef PythonClassObject<Base::Vector2dPy> Vector2d;
inline Base::Vector2d toVector2d(PyObject *py) {
Base::Vector2dPy* py2d = Py::Vector2d(py).getCxxObject();
return py2d ? py2d->value() : Base::Vector2d();
}
inline Base::Vector2d toVector2d(const Object& py) {
Base::Vector2dPy* py2d = Py::Vector2d(py).getCxxObject();
return py2d ? py2d->value() : Base::Vector2d();
}
// Implementing the vector class in the fashion of the PyCXX library.
class BaseExport Vector : public Object
{