]> OCCT Git - occt-copy.git/commitdiff
Fix for crash when selected shape without surface
authordbv <dbv@opencascade.com>
Thu, 13 Oct 2016 11:20:51 +0000 (14:20 +0300)
committeraba <aba@opencascade.com>
Wed, 25 Jan 2017 08:09:54 +0000 (11:09 +0300)
src/BRepAdaptor/BRepAdaptor_Surface.cxx
src/Extrema/Extrema_GenExtPS.cxx

index 850facead96db0221981727a0997a9f048dbec2d..b0e8dc47f276b6a4fc65564160b47ebf20310133 100644 (file)
@@ -72,18 +72,19 @@ void BRepAdaptor_Surface::Initialize(const TopoDS_Face& F,
 {
   myFace = F;
   TopLoc_Location L;
-  const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface(F, L);
-  if (aSurface.IsNull())
+  const Handle (Geom_Surface)& aSurface = BRep_Tool::Surface (F, L);
+  if (aSurface.IsNull ())
     return;
 
-  if (Restriction) {
-    Standard_Real umin,umax,vmin,vmax;
-    BRepTools::UVBounds(F,umin,umax,vmin,vmax);
-    mySurf.Load(aSurface,umin,umax,vmin,vmax);
+  if (Restriction)
+  {
+    Standard_Real umin, umax, vmin, vmax;
+    BRepTools::UVBounds (F, umin, umax, vmin, vmax);
+    mySurf.Load (aSurface, umin, umax, vmin, vmax);
   }
-  else 
-    mySurf.Load(aSurface);
-  myTrsf = L.Transformation();
+  else
+    mySurf.Load (aSurface);
+  myTrsf = L.Transformation ();
 }
 
 
@@ -425,6 +426,10 @@ Handle(Adaptor3d_HCurve) BRepAdaptor_Surface::BasisCurve() const
 
 Handle(Adaptor3d_HSurface) BRepAdaptor_Surface::BasisSurface() const 
 {  
+  if(mySurf.Surface().IsNull())
+  {
+    return Handle(Adaptor3d_HSurface)();
+  }
   Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface();
   HS->ChangeSurface().Load
     (Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
index 6c949bc0cd781c5dfe7ae54e22461272a6458e9e..24279056f3d45c7cfd6e92842f40a42678fe55b8 100644 (file)
@@ -803,6 +803,11 @@ void Extrema_GenExtPS::Perform(const gp_Pnt& P)
   myDone = Standard_False;
   myF.SetPoint(P);
   
+  if (myS->BasisSurface ().IsNull ())
+  {
+    return;
+  }
+
   if(myAlgo == Extrema_ExtAlgo_Grad)
   {
     BuildGrid(P);