photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp
changeset 2 7d9067c6fcb1
parent 0 4e91876724a2
child 9 6b87b143d312
--- a/photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp	Thu Jan 07 12:46:23 2010 +0200
+++ b/photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp	Mon Jan 18 20:19:20 2010 +0200
@@ -162,6 +162,7 @@
         iMediaList = &iMediaListFactory->CreateMediaListL(*iCollectionUtility);
     	iMediaList->AddContextL(iPreloadContextForCommandHandlers, 0);
         }
+    __ASSERT_ALWAYS(iMediaList, Panic(EGlxPanicNullMediaList));
 
     if(iFixedTitle)
         {
@@ -181,7 +182,7 @@
    
     //Allow the MskController to observe medialist everytime a view with a valid
     //medialist becomes active
-    if( iCbaControl && iMediaList && Cba()&& iEnableMidddleSoftkey )
+    if( iCbaControl && Cba()&& iEnableMidddleSoftkey )
         {
         CMPXCollectionPath* navigationalState = iCollectionUtility->Collection().PathL();
         CleanupStack::PushL(navigationalState);
@@ -215,21 +216,25 @@
 EXPORT_C void CGlxMediaListViewBase::DoViewDeactivate()
     {
     DoMLViewDeactivate();
-    if( iCbaControl && iMediaList && Cba() )
-        {
-        //Remove Mskcontroller from medialist observer
-        iCbaControl->RemoveFromObserver(*iMediaList);
-        }
-    if( Toolbar() && iToolbarControl )
+
+    if( iMediaList )
         {
-        //Remove Toolbarcontroller from medialist observer
-        iToolbarControl->RemoveFromObserver(*iMediaList);
-        }    
-    
-    // Only close the medialist if navigating backwards
-    if ( iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards )
-        {
-        CloseMediaList();
+        if (iCbaControl && Cba())
+            {
+            //Remove Mskcontroller from medialist observer
+            iCbaControl->RemoveFromObserver(*iMediaList);
+            }
+        if (Toolbar() && iToolbarControl)
+            {
+            //Remove Toolbarcontroller from medialist observer
+            iToolbarControl->RemoveFromObserver(*iMediaList);
+            }
+
+        // Only close the medialist if navigating backwards
+        if (iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards)
+            {
+            CloseMediaList();
+            }
         }
 
     delete iTitleFetcher;