From 026801e28d1e048b907a51998c4009f490bed6ff Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Wed, 3 Feb 2016 21:14:06 -0700 Subject: [PATCH] In SongID::ToSong, check whether the dir is empty before prepending a slash, so GetSongFromDir can be skipped when the dir is empty. --- src/SongUtil.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index 3aaa2d7edc..0130e76acb 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -1132,14 +1132,17 @@ Song *SongID::ToSong() const Song *pRet = NULL; if( !m_Cache.Get(&pRet) ) { - // HACK for backwards compatibility: Re-add the leading "/". - // 2005/05/21 file layer changes added a leading slash. - RString sDir2 = sDir; - if( sDir2.Left(1) != "/" ) - sDir2 = "/" + sDir2; - - if( !sDir2.empty() ) - pRet = SONGMAN->GetSongFromDir( sDir2 ); + if(!sDir.empty()) + { + // HACK for backwards compatibility: Re-add the leading "/". + // 2005/05/21 file layer changes added a leading slash. + RString sDir2 = sDir; + if(sDir2.Left(1) != "/") + { + sDir2 = "/" + sDir2; + } + pRet = SONGMAN->GetSongFromDir(sDir2); + } m_Cache.Set( pRet ); } return pRet;