From 8eb86379ea34dea4b5bbdf65588fde9868d2c183 Mon Sep 17 00:00:00 2001 From: adv Date: Thu, 26 Dec 2013 10:54:39 +0000 Subject: [PATCH] Import bathymetry protection (Bug #203). --- src/HYDROData/HYDROData_Bathymetry.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index 8d679bd2..ec3ed113 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -4,6 +4,8 @@ #include "HYDROData_Tool.h" #include "HYDROData_PolylineXY.h" +#include + #include #include @@ -463,6 +465,11 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, if ( !isXOk || !isYOk || !isZOk ) return false; + if ( boost::math::isnan( aPoint.X() ) || boost::math::isinf( aPoint.X() ) || + boost::math::isnan( aPoint.Y() ) || boost::math::isinf( aPoint.Y() ) || + boost::math::isnan( aPoint.Z() ) || boost::math::isinf( aPoint.Z() ) ) + return false; + // Invert the z value if requested if ( anIsAltitudesInverted ) aPoint.SetZ( -aPoint.Z() ); -- 2.39.2