0027070: Segfault when transferring HLR-created shapes via STEPControl_Writer
[occt.git] / src / XSControl / XSControl_WorkSession.cxx
index 32e91c8..0ffc9fd 100644 (file)
@@ -205,7 +205,11 @@ Standard_Boolean  XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
     }
 
     S<<"Transfer Write item n0."<<ne<<" of "<<max;
-    if (nr > 0) S<<"  ** Transfer Root n0."<<ne;  S<<endl;
+    if (nr > 0)
+    {
+      S<<"  ** Transfer Root n0."<<ne;
+    }
+    S<<endl;
     ent = FP->FindTransient(finder);
     S<<" -> Type "<<finder->DynamicType()->Name()<<endl;
     FP->StartTrace (binder,finder,0,0);  // pb sout/S
@@ -240,7 +244,11 @@ Standard_Boolean  XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
     }
 
     S<<"Transfer Read item n0."<<ne<<" of "<<max;
-    if (nr > 0) S<<"  ** Transfer Root n0."<<ne;  S<<endl;
+    if (nr > 0)
+    {
+      S<<"  ** Transfer Root n0."<<ne;
+    }
+    S<<endl;
     if (!model.IsNull())  {  S<<" In Model, Entity ";  model->Print(ent,S); }
     binder = TP->MapItem (ne);
     S<<endl;
@@ -450,7 +458,10 @@ IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape (const TopoDS_Sh
   IFSelect_ReturnStatus  status;
   if (myController.IsNull()) return IFSelect_RetError;
   const Handle(Interface_InterfaceModel) &model = Model();
-  if (model.IsNull()) return IFSelect_RetVoid;
+  if (model.IsNull() || shape.IsNull())
+  {
+    return IFSelect_RetVoid;
+  }
 
   status = myTransferWriter->TransferWriteShape (model,shape);
   //  qui s occupe de tout, try/catch inclus