omadm/omadmextensions/adapters/connmoadapter/src/NapBranch.cpp
changeset 2 a5fecba4b1e4
parent 1 4490afcb47b1
--- a/omadm/omadmextensions/adapters/connmoadapter/src/NapBranch.cpp	Thu Jan 07 12:39:15 2010 +0200
+++ b/omadm/omadmextensions/adapters/connmoadapter/src/NapBranch.cpp	Mon Jan 18 20:09:30 2010 +0200
@@ -1192,11 +1192,24 @@
         // Sanity check: If the dynamic name of the NAP node has is the same as deleted previously and
         // DM Framework hasn't updated the tree, it will give the LUID when calling this method. Thus,
         // it's needed to check that the connection method really exists.
-        RCmConnectionMethodExt cm;        
-
-        if ( !GetConnectionMethodLC( *iCmManager, cm,  CUtils::IntLUID( aParentLUID) ) )
-            {
-            // New node, add to buffer
+        TBuf8<KSmlMaxURISegLen> parentLUID;
+        parentLUID.Zero();
+        parentLUID = aParentLUID;
+        RCmConnectionMethodExt cm;               
+        if ( !GetConnectionMethodLC( *iCmManager, cm,  CUtils::IntLUID( parentLUID) ) )
+            {            
+			if(aParentLUID.Length() > 0)
+				{
+				TInt ret = iCallback->RemoveMappingL(KConnMoAdapterUid,
+							GetDynamicNAPNodeUri( aURI ), ETrue );
+				if(ret)
+					{
+					iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+					CleanupStack::PopAndDestroy( &cm );
+					return;
+					}				
+				}
+			// New node, add to buffer
             iBuffer->AddNodeToBufferL( aURI, KNullDesC8, aStatusRef );
             OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE2,
                     "CNapBranch::AddNodeObjectL;New node -> Add to buffer." );