# HG changeset patch # User Sebastian Brannstrom # Date 1288011787 -3600 # Node ID e6a88732eb8fe62cd3c6bb3cf1d543110fb5634d # Parent 69385a7c98105a299320b8f80abf573b4d889b4a For for a potential crash bug when a show URL does not contain a period diff -r 69385a7c9810 -r e6a88732eb8f engine/src/ShowEngine.cpp --- a/engine/src/ShowEngine.cpp Sun Oct 24 01:27:31 2010 +0100 +++ b/engine/src/ShowEngine.cpp Mon Oct 25 14:03:07 2010 +0100 @@ -190,13 +190,25 @@ TFileName fileName; PodcastUtils::FileNameFromUrl(info->Url(), fileName); - TFileName extension; - extension.Copy(fileName.Mid(fileName.LocateReverse('.'))); - DP1("extension=%S", &extension); - TFileName newFilename; - newFilename.Format(_L("%u%S"), info->Uid(), &extension); - DP1("newFilename=%S", &newFilename); + + TInt periodPos = fileName.LocateReverse('.'); + + if (periodPos != -1) + { + // file extension (most likely) found + TFileName extension; + extension.Copy(fileName.Mid(periodPos)); + DP1("extension=%S", &extension); + + newFilename.Format(_L("%u%S"), info->Uid(), &extension); + DP1("newFilename=%S", &newFilename); + } + else + { + // no extension found, we'll have to rely on magic numbers + newFilename.Copy(fileName); + } relPath.Append(newFilename); PodcastUtils::EnsureProperPathName(relPath);