Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds RCL_3
authorSebastian Brannstrom <sebastianb@symbian.org>
Fri, 12 Nov 2010 15:59:01 +0100
branchRCL_3
changeset 330 4cf89a7d3476
parent 328 75a70f4a4f6d
child 331 c44ad45736ff
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
engine/src/FeedParser.cpp
--- a/engine/src/FeedParser.cpp	Mon Nov 01 22:59:47 2010 +0000
+++ b/engine/src/FeedParser.cpp	Fri Nov 12 15:59:01 2010 +0100
@@ -321,57 +321,64 @@
 		case EStateItemPubDate:
 			DP1("PubDate END: iBuffer='%S'", &iBuffer);
 			if (str.CompareF(KTagPubDate) == 0) {
-				// hack for feeds that don't always write day as two digits
-				TChar five(iBuffer[5]);
-				TChar six(iBuffer[6]);
+				DP1("iBuffer.Length()=%d", iBuffer.Length());
 				
-				if (five.IsDigit() && !six.IsDigit()) {
-					TBuf<KMaxStringBuffer> fix;
-					fix.Copy(iBuffer.Left(4));
-					fix.Append(_L(" 0"));
-					fix.Append(iBuffer.Mid(5));
-					iBuffer.Copy(fix);
-				}
-				// end hack
+				if (iBuffer.Length() > 6)
+					{
+					// hack for feeds that don't always write day as two digits
+					TChar five(iBuffer[5]);
+					TChar six(iBuffer[6]);
+					
+					if (five.IsDigit() && !six.IsDigit()) {
+						TBuf<KMaxStringBuffer> fix;
+						fix.Copy(iBuffer.Left(4));
+						fix.Append(_L(" 0"));
+						fix.Append(iBuffer.Mid(5));
+						iBuffer.Copy(fix);
+					}
+					// end hack
+					}
 				
-				// hack for feeds that write out months in full
-				
-				if (iBuffer[11] != ' ') {
-					TPtrC midPtr = iBuffer.Mid(8);
+				if (iBuffer.Length() > 11)
+					{
+					// hack for feeds that write out months in full
 					
-					int spacePos = midPtr.Find(_L(" "));
-					
-					if (spacePos != KErrNotFound) {
-						//DP1("Month: %S", &midPtr.Left(spacePos));
+					if (iBuffer[11] != ' ') {
+						TPtrC midPtr = iBuffer.Mid(8);
+						
+						int spacePos = midPtr.Find(_L(" "));
 						
-						TBuf16<KBufferLength> newBuffer;
-						newBuffer.Copy(iBuffer.Left(11));
-						newBuffer.Append(_L(" "));
-						newBuffer.Append(iBuffer.Mid(11+spacePos));
-						//DP1("newBuffer: %S", &newBuffer);
-						iBuffer.Copy(newBuffer);
+						if (spacePos != KErrNotFound) {
+							//DP1("Month: %S", &midPtr.Left(spacePos));
+							
+							TBuf16<KBufferLength> newBuffer;
+							newBuffer.Copy(iBuffer.Left(11));
+							newBuffer.Append(_L(" "));
+							newBuffer.Append(iBuffer.Mid(11+spacePos));
+							//DP1("newBuffer: %S", &newBuffer);
+							iBuffer.Copy(newBuffer);
+						}
 					}
-				}
-				
-				// hack for feeds that write days and months as UPPERCASE
-				TChar one(iBuffer[1]);
-				TChar two(iBuffer[2]);
-				TChar nine(iBuffer[9]);
-				TChar ten(iBuffer[10]);
+					
+					// hack for feeds that write days and months as UPPERCASE
+					TChar one(iBuffer[1]);
+					TChar two(iBuffer[2]);
+					TChar nine(iBuffer[9]);
+					TChar ten(iBuffer[10]);
+	
+					one.LowerCase();
+					two.LowerCase();
+					nine.LowerCase();
+					ten.LowerCase();
+					
+					iBuffer[1] = one;
+					iBuffer[2] = two;
+					iBuffer[9] = nine;
+					iBuffer[10] = ten;
+					}
 
-				one.LowerCase();
-				two.LowerCase();
-				nine.LowerCase();
-				ten.LowerCase();
-				
-				iBuffer[1] = one;
-				iBuffer[2] = two;
-				iBuffer[9] = nine;
-				iBuffer[10] = ten;
-				
 				TBuf8<128> temp;
 				temp.Copy(iBuffer);
-
 				TInternetDate internetDate;
 				TRAPD(parseError, internetDate.SetDateL(temp));
 				if(parseError == KErrNone) {