Fis for 2818 part 2 - feeds with invalid image URLs crash RCL_3
authorSebastian Brannstrom <sebastianb@symbian.org>
Fri, 12 Nov 2010 17:27:40 +0100
branchRCL_3
changeset 334 a7cb97979427
parent 333 c80c7fb835c2
child 335 1db465fb29ce
Fis for 2818 part 2 - feeds with invalid image URLs crash
engine/src/FeedEngine.cpp
--- a/engine/src/FeedEngine.cpp	Fri Nov 12 17:27:16 2010 +0100
+++ b/engine/src/FeedEngine.cpp	Fri Nov 12 17:27:40 2010 +0100
@@ -101,6 +101,7 @@
 
 CFeedEngine::~CFeedEngine()
 	{
+	DP("~CFeedEngine BEGIN");
 	iObservers.Close();
 	
 	iFeedsUpdating.Close();
@@ -112,6 +113,7 @@
 	delete iOpmlParser;
 	//
 	delete iRepository;
+	DP("~CFeedEngine END");
 	}
 
 /**
@@ -299,7 +301,7 @@
 
 void CFeedEngine::NewShowL(CShowInfo& aItem)
 	{
-	DP1("NewShowL, aItem.Title()=%S", &aItem.Title());
+	DP1("CFeedEngine::NewShowL BEGIN, aItem.Title()=%S", &aItem.Title());
 	HBufC* description = HBufC::NewLC(KMaxDescriptionLength);
 	TPtr ptr(description->Des());
 	ptr.Copy(aItem.Description());
@@ -326,6 +328,7 @@
 		}
 	
 	showsAdded++;
+	DP("CFeedEngine::NewShowL END");
 	}
 
 void CFeedEngine::GetFeedImageL(CFeedInfo *aFeedInfo)
@@ -342,6 +345,11 @@
 
 	TFileName fileName;
 	PodcastUtils::FileNameFromUrl(aFeedInfo->ImageUrl(), fileName);
+	fileName.Trim();
+	
+	if (fileName.Length() == 0)
+		User::Leave(KErrNotFound);
+	
 	relPath.Append(fileName);
 	PodcastUtils::EnsureProperPathName(relPath);
 	
@@ -668,6 +676,7 @@
 				// now the image has been downloaded, so we set it again in the FeedInfo to start
 				// converting it
 				HBufC *fileNameCopy = iActiveFeed->ImageFileName().AllocLC();
+				DP1("fnc=%S", fileNameCopy);
 				TRAP_IGNORE(iActiveFeed->SetImageFileNameL(*fileNameCopy, &iPodcastModel));
 				CleanupStack::PopAndDestroy(fileNameCopy);
 				}