Salome HOME
Fix pb with contour closure: respect NULL wires list
authorjfa <jfa@opencascade.com>
Thu, 18 Aug 2005 10:07:02 +0000 (10:07 +0000)
committerjfa <jfa@opencascade.com>
Thu, 18 Aug 2005 10:07:02 +0000 (10:07 +0000)
src/GEOMImpl/GEOMImpl_IHealingOperations.cxx

index cdf948d8c9c4b90e5398ac1dc1382c01a3053d29..08e0c37579c4a127c7079e9e442890761f7cf948 100644 (file)
@@ -365,7 +365,10 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour
   SetErrorCode(KO);
 
   if (theObject.IsNull())
+  {
+    SetErrorCode("NULL object given");
     return NULL;
+  }
 
   Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
   if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed
@@ -408,11 +411,14 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour
   pd << aNewObject << " = geompy.CloseContour(" << theObject << ", [";
 
   // list of wire ids
-  int i = theWires->Lower(), nb = theWires->Upper();
-  for ( ; i <= nb; i++)
-    pd << theWires->Value( i ) << (( i < nb ) ? ", " : "], ");
-
-  pd << (int)isCommonVertex << ")";
+  if (!theWires.IsNull())
+  {
+    int i = theWires->Lower(), nb = theWires->Upper();
+    pd << theWires->Value(i++);
+    while (i <= nb)
+      pd << ", " << theWires->Value(i++);
+  }
+  pd << "], " << (int)isCommonVertex << ")";
 
   SetErrorCode(OK);
   return aNewObject;