From 000919a7c2d261a27b572dc8ab319c1a2d9118d0 Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 15 Mar 2013 07:30:06 +0000 Subject: [PATCH] Some checks in translate/scale --- src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx | 4 ++++ src/MEDCoupling/MEDCouplingPointSet.cxx | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index a35c5b9dd..be5a38af3 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -638,6 +638,8 @@ void MEDCouplingCurveLinearMesh::rotate(const double *center, const double *vect void MEDCouplingCurveLinearMesh::translate(const double *vector) { + if(!vector) + throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::translate : NULL input point !"); if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::translate : no coordinates set !"); double *coords=_coords->getPointer(); @@ -652,6 +654,8 @@ void MEDCouplingCurveLinearMesh::translate(const double *vector) void MEDCouplingCurveLinearMesh::scale(const double *point, double factor) { + if(!point) + throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : NULL input point !"); if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !"); double *coords=_coords->getPointer(); diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 4fc496b5f..3f6886a53 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -400,6 +400,10 @@ void MEDCouplingPointSet::rotate(const double *center, const double *vector, dou */ void MEDCouplingPointSet::translate(const double *vector) { + if(!vector) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::translate : NULL input vector !"); + if(!_coords) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::translate : no coordinates set !"); double *coords=_coords->getPointer(); int nbNodes=getNumberOfNodes(); int dim=getSpaceDimension(); @@ -417,6 +421,10 @@ void MEDCouplingPointSet::translate(const double *vector) */ void MEDCouplingPointSet::scale(const double *point, double factor) { + if(!point) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::scale : NULL input point !"); + if(!_coords) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::scale : no coordinates set !"); double *coords=_coords->getPointer(); int nbNodes=getNumberOfNodes(); int dim=getSpaceDimension(); -- 2.39.2