Salome HOME
Bug #490: batch mode error.
[modules/hydro.git] / src / HYDROData / HYDROData_ObstacleAltitude.cxx
index 0c300146196f86a2839d6104966a3af6469e7d80..4d0679aaf6c47cd8b1f9dbefdb9cf79966c30d90 100644 (file)
@@ -34,12 +34,12 @@ double HYDROData_ObstacleAltitude::GetAltitudeForPoint( const gp_XY& thePoint )
   if ( anObjectShape3D.IsNull() )
     return aResAltitude;
 
-  gp_Pnt aHighestPoint;
-
   HYDROData_Make3dMesh aMesher3D( anObjectShape3D, Precision::Intersection() );
-  aMesher3D.GetHighestOriginal( thePoint.X(), thePoint.Y(), aHighestPoint );
 
-  aResAltitude = aHighestPoint.Z();
+  gp_Pnt aHighestPoint;
+  if ( aMesher3D.GetHighestOriginal( thePoint.X(), thePoint.Y(), aHighestPoint ) )
+    aResAltitude = aHighestPoint.Z();
+
   return aResAltitude;
 }