# HG changeset patch # User Sebastian Brannstrom # Date 1289579236 -3600 # Node ID c80c7fb835c2caf445adda6dc5acb799ff3bb84f # Parent 88a24b8b97d8b4f6a0c4c8c20c703f4d64de8f8c Fis for 2818 part 1 - crash in CleanHtmlL diff -r 88a24b8b97d8 -r c80c7fb835c2 engine/src/PodcastUtils.cpp --- a/engine/src/PodcastUtils.cpp Fri Nov 12 17:26:03 2010 +0100 +++ b/engine/src/PodcastUtils.cpp Fri Nov 12 17:27:16 2010 +0100 @@ -68,13 +68,13 @@ EXPORT_C void PodcastUtils::CleanHtmlL(TDes &str) { - + DP("PodcastUtils::CleanHtmlL BEGIN"); if (str.Length() == 0) { return; } - // miscellaneous cleanup + DP(" miscellaneous cleanup"); const TChar KLineBreak(CEditableText::ELineBreak); _LIT(KNewLine, "\n"); _LIT(KNewLineWindows, "\r\n"); @@ -82,7 +82,7 @@ ReplaceString(str, KNewLineWindows, KNullDesC); // strip out HTML tags - + DP(" strip out HTML tags"); TInt startPos = str.Locate('<'); TInt endPos = str.Locate('>'); HBufC* tmpBuf = HBufC::NewLC(KMaxDescriptionLength); @@ -115,6 +115,7 @@ } // change HTML encoded chars to unicode + DP(" change HTML encoded chars to unicode"); startPos = str.Locate('&'); endPos = str.Locate(';'); while (startPos != KErrNotFound && endPos != KErrNotFound && endPos > startPos) @@ -207,18 +208,20 @@ if(str.Length()>1) { // chop away newlines at start - while ((str[0] == KLineBreak) ) { + DP(" chop away newlines at start"); + while (str.Length() > 0 && (str[0] == KLineBreak)) { str = str.Mid(1); } // chop away newlines at end - - while ((str[str.Length()-1] == KLineBreak)) { + DP(" chop away newlines at end"); + while (str.Length() > 0 && (str[str.Length()-1] == KLineBreak)) { str = str.Left(str.Length()-1); } str.Trim(); } + DP("PodcastUtils::CleanHtmlL END"); } EXPORT_C void PodcastUtils::RemoveAllFormatting(TDes & aString)