bluetoothengine/btnotif/src/BTNotifier.cpp
branchRCL_3
changeset 13 b6f55cd40afd
parent 6 6a29d5ad0713
--- a/bluetoothengine/btnotif/src/BTNotifier.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btnotif/src/BTNotifier.cpp	Wed Mar 31 21:51:05 2010 +0300
@@ -490,16 +490,20 @@
     iDevice->DeleteLinkKey();
  
     iBTRegistryQueryState = ESetDeviceBlocked;
+    TInt err = KErrNone;
     if( !iDevMan )
         {
-        iDevMan = CBTEngDevMan::NewL( this );    
+        TRAP(err, iDevMan = CBTEngDevMan::NewL( this ));    
+        }
+    if( !err )
+        {
+        err = iDevMan->ModifyDevice( *iDevice );
         }
-    TInt devManErr = iDevMan->ModifyDevice( *iDevice );     
-            
-    // if error, complete message, otherwise waiting for devman callback
-    //
-    if(devManErr != KErrNone)
-        CompleteMessage(devManErr); 
+    if( err )
+        {
+        // if error, complete message, otherwise waiting for devman callback
+        CompleteMessage(err); 
+        }
     }
 
 void CBTNotifierBase::ChangeAuthorizeState( TBool aTrust )
@@ -511,17 +515,19 @@
     iDevice->SetGlobalSecurity(sec);
  
     iBTRegistryQueryState = ESetDeviceAuthorizeState;
+    TInt err = KErrNone;
     if( !iDevMan )
-        {
-        iDevMan = CBTEngDevMan::NewL( this );    
+        {    
+        TRAP(err, iDevMan = CBTEngDevMan::NewL( this ));
         }
-    TInt devManErr = iDevMan->ModifyDevice( *iDevice );     
-            
-    // if error, complete message, otherwise waiting for devman callback
-    //
-    if(devManErr != KErrNone)
+    if( !err )
         {
-        CompleteMessage(devManErr); 
+        err = iDevMan->ModifyDevice( *iDevice );
+        }
+    if( err )
+        {
+        // if error, complete message, otherwise waiting for devman callback        
+        CompleteMessage(err); 
         TBTNotifLockPublish::DeleteNotifLocks( 
                 EBTNotiferLockPairedDeviceSetting, iDevice->BDAddr() );
         }