From: ageay Date: Fri, 15 Mar 2013 16:27:17 +0000 (+0000) Subject: Some protections against not kind C++ users. X-Git-Tag: V6_main_FINAL~272 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a0bd0fe7f3a62f6c354caa90351fb49b52b395f;p=tools%2Fmedcoupling.git Some protections against not kind C++ users. --- 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(); }