--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Tue May 11 17:53:46 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Tue May 25 14:39:45 2010 +0300
@@ -212,9 +212,12 @@
LOG_FUNC
// Complete client with KErrCancel
CompleteClient(KErrCancel);
-
+
// Cancel current pending command
- iSubCommandQueue.Head().CancelAsyncCmd();
+ if (iSubCommandQueue.Count())
+ {
+ iSubCommandQueue.Head().CancelAsyncCmd();
+ }
}
void CDeviceEventHandler::RunL( )
@@ -251,30 +254,33 @@
TInt CDeviceEventHandler::RunError(TInt aError)
{
LOG_FUNC
- // Retrieve sub-command related error notification data
- iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
-
- // If current sub-command isn't a key one, the handler will continue to
- // execute rest sub-command in the queue. But, if current sub-command
- // is the last one in the queue, handler shall complete the client also.
- if (iSubCommandQueue.Head().IsKeyCommand() ||
- (iSubCommandQueue.Count() == 1))
+
+ if (iSubCommandQueue.Count())
{
- CompleteClient(aError);
+ // Retrieve sub-command related error notification data
+ iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
+
+ // If current sub-command isn't a key one, the handler will continue to
+ // execute rest sub-command in the queue. But, if current sub-command
+ // is the last one in the queue, handler shall complete the client also.
+ if (iSubCommandQueue.Head().IsKeyCommand() ||
+ (iSubCommandQueue.Count() == 1))
+ {
+ CompleteClient(aError);
+ }
+ iSubCommandQueue.Pop();
}
- //Restart the handler after error handling;
- if (!IsActive())
+ if( IsActive() )
+ {
+ Complete(aError);
+ }
+ else if (iSubCommandQueue.Count())
{
Start();
+ Complete();
}
- Complete(aError);
-
- if (iSubCommandQueue.Count())
- {
- iSubCommandQueue.Pop();
- }
-
+
return KErrNone;
}