From 0a0bd0fe7f3a62f6c354caa90351fb49b52b395f Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 15 Mar 2013 16:27:17 +0000 Subject: [PATCH] Some protections against not kind C++ users. --- src/MEDCoupling/MEDCouplingPointSet.cxx | 10 ++++++++++ src/MEDCoupling/MEDCouplingUMesh.cxx | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 09582e6a3..f8480f8c2 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -655,9 +655,15 @@ void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, { if(getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : Invalid spacedim to be applied on this ! Must be equal to 3 !"); + if(!pt) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL point pointer specified !"); + if(!vec) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL vector pointer specified !"); int nbOfNodes=getNumberOfNodes(); double a=vec[0],b=vec[1],c=vec[2],d=-pt[0]*vec[0]-pt[1]*vec[1]-pt[2]*vec[2]; double deno=sqrt(a*a+b*b+c*c); + if(deno::min()) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : vector pointer specified has norm equal to 0. !"); const double *work=_coords->getConstPointer(); for(int i=0;i3) + throw INTERP_KERNEL::Exception("Invalid meshDim specified ! Must be greater or equal to -1 and lower or equal to 3 !"); _mesh_dim=meshDim; declareAsNew(); } -- 2.39.2