idlehomescreen/widgetmanager/src/wmwidgetloaderao.cpp
branchRCL_3
changeset 9 f966699dea19
parent 5 c743ef5928ba
child 15 ff572dfe6d86
--- a/idlehomescreen/widgetmanager/src/wmwidgetloaderao.cpp	Tue Feb 02 00:04:13 2010 +0200
+++ b/idlehomescreen/widgetmanager/src/wmwidgetloaderao.cpp	Fri Feb 19 22:42:37 2010 +0200
@@ -135,6 +135,7 @@
     controller.WidgetListL( *contentInfoArray );
     
     // 2. load the widget order
+    if ( iWidgetOrder ) { Cleanup(); }
     iWidgetOrder = CWmPersistentWidgetOrder::NewL( iWmPlugin.FileServer() );
     TRAPD( loadError, iWidgetOrder->LoadL() );
 
@@ -152,6 +153,7 @@
     while( contentInfoArray->Array().Count() > 0 )
         {
         CHsContentInfo* contentInfo = contentInfoArray->Array()[0];
+        if ( !contentInfo ) { break; }
         contentInfoArray->Array().Remove( 0 );
 
         // check if this widget exists.
@@ -255,19 +257,20 @@
         }
     CleanupStack::Pop( aContentInfo );
     
-    CWmWidgetData* widgetData = CWmWidgetData::NewLC( 
+    CWmWidgetData* widgetData = CWmWidgetData::NewLC(
             iWidgetsList.LogoSize(),
             iWmPlugin.ResourceLoader(),
             aContentInfo, iWidgetRegistry );
     widgetData->SetPersistentWidgetOrder( iWidgetOrder );
     widgetData->SetValid( ETrue );
-    iWidgetsList.AddWidgetDataL( widgetData, EFalse );
-    if ( iUninstallUid != KNullUid 
-            && iUninstallUid == widgetData->PublisherUid() )
+       
+    if ( iUninstallUid != KNullUid &&
+        iUninstallUid == widgetData->PublisherUid() )
         {
         widgetData->VisualizeUninstallL();
         }
     
+    iWidgetsList.AddWidgetDataL( widgetData, EFalse );
     CleanupStack::Pop( widgetData );
     }