idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/src/xnnewstickercontrol.cpp
changeset 1 5315654608de
parent 0 f72a12da539e
child 2 08c6ee43b396
--- a/idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/src/xnnewstickercontrol.cpp	Thu Dec 17 08:40:49 2009 +0200
+++ b/idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/src/xnnewstickercontrol.cpp	Thu Jan 07 12:39:41 2010 +0200
@@ -422,7 +422,7 @@
 //
 const TDesC& CXnNewstickerControl::Title(TInt aIndex)
     {
-    if (aIndex < 0 || aIndex > iTitles.Count())
+    if (aIndex < 0 || aIndex >= iTitles.Count())
         {
         return KNullDesC;
         }
@@ -513,6 +513,11 @@
 //
 const TDesC8& CXnNewstickerControl::CurrentSvgTitle()
     {
+    if ( iFirstDrawingTitleIndex < 0 || iFirstDrawingTitleIndex >= iTitles.Count() )
+        {
+        return KNullDesC8;
+        }
+    
     CTitleData* title = iTitles[iFirstDrawingTitleIndex];
     //  Is it SVG title
     if (title->IsSvgTitle())
@@ -787,7 +792,7 @@
         return;
         }
     iFirstDrawingTitleIndex = GetNextTitleWithContent( iFirstDrawingTitleIndex );
-    if ( iFirstDrawingTitleIndex < 0 )
+    if ( iFirstDrawingTitleIndex < 0 || iFirstDrawingTitleIndex >= iTitles.Count() )
         {
         return;
         }
@@ -938,6 +943,10 @@
         {
         return;
         }
+    if ( iFirstDrawingTitleIndex < 0 || iFirstDrawingTitleIndex >= iTitles.Count() )
+        {
+        return;
+        }
     if (iTitles[iFirstDrawingTitleIndex]->IsSvgTitle())
         {
         //  Show SVG title
@@ -1086,7 +1095,8 @@
 void CXnNewstickerControl::DoScrollL()
     {
     //  If there are no titles, don't do anything.
-    if( !IsVisibleTitles() || iFirstDrawingTitleIndex < 0 )
+    if( !IsVisibleTitles() || iFirstDrawingTitleIndex < 0 || 
+            iFirstDrawingTitleIndex >= iTitles.Count() )
         {
         return;
         }
@@ -1317,7 +1327,7 @@
         const TInt count = iTitles.Count();
         TInt textWidth=0;
         const TInt rectWidth = iContentRect.Width();
-        if( iCurrentTitleIndex < count )
+        if( iCurrentTitleIndex >= 0 && iCurrentTitleIndex < count )
             {
             textWidth = iTitles[iCurrentTitleIndex]->TitleTextLengthInPixels();
             }