kdecore: avoid two cache lookups in KStandardDirsPrivate::exists()

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-07-26 11:20:32 +00:00
parent 55cc3a3f02
commit 3ed846617d

View file

@ -554,10 +554,8 @@ bool KStandardDirs::exists(const QString &fullPath) const
bool KStandardDirs::KStandardDirsPrivate::exists(const QString &fullPath)
{
QFileInfo *fileinfo;
if(m_infocache.contains(fullPath)) {
fileinfo = m_infocache.object(fullPath);
} else {
QFileInfo *fileinfo = m_infocache.object(fullPath);
if (!fileinfo) {
fileinfo = new QFileInfo(fullPath);
m_infocache.insert(fullPath, fileinfo);
}