Salome HOME
CCAR: add a check to see if the CORBA object exists (non_existent())
authorcaremoli <caremoli>
Fri, 18 Sep 2009 15:18:51 +0000 (15:18 +0000)
committercaremoli <caremoli>
Fri, 18 Sep 2009 15:18:51 +0000 (15:18 +0000)
src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx

index 3ce91128632e4033810522e689cfc5ffdd485cca..ad85e1f2ec57ded6ccde665fde401e80668ceba3 100644 (file)
@@ -46,12 +46,13 @@ void IORGenericObjDecref(const std::string& anIOR)
   SALOME::GenericObj_var gobj;
   try
     {
-       obj = getORB()->string_to_object(anIOR.c_str());
-       gobj = SALOME::GenericObj::_narrow(obj);
-       if(! CORBA::is_nil(gobj) )
-         {
-           gobj->Destroy();
-         }
+      obj = getORB()->string_to_object(anIOR.c_str());
+      if(obj->_non_existent())return;
+      gobj = SALOME::GenericObj::_narrow(obj);
+      if(! CORBA::is_nil(gobj) )
+        {
+          gobj->Destroy();
+        }
     }
   catch(const CORBA::Exception& e)
     {
@@ -65,6 +66,7 @@ void IORGenericObjIncref(const std::string& anIOR)
   try
     {
       obj = getORB()->string_to_object(anIOR.c_str());
+      if(obj->_non_existent())return;
       gobj = SALOME::GenericObj::_narrow(obj);
       if(! CORBA::is_nil(gobj) )
         {
@@ -96,7 +98,7 @@ const std::string& SALOMEDSImpl_AttributeIOR::GetID ()
 //=======================================================================
 
 SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L,
-                                                          const std::string& S) 
+                                                           const std::string& S) 
 {
   SALOMEDSImpl_AttributeIOR* A = NULL;
   if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {