1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Don't iterate over each result if we already know the required action early

This commit is contained in:
Uwe L. Korn
2014-11-16 11:11:45 +01:00
parent 52613693e3
commit eabcbf0632

View File

@@ -973,15 +973,15 @@ DropJob::removeRemoteSources()
continue; continue;
} }
bool hasLocalSource = false;
foreach ( const Tomahawk::result_ptr& result, item->results() ) foreach ( const Tomahawk::result_ptr& result, item->results() )
{ {
if ( !result->collection().isNull() && !result->collection()->source().isNull() if ( !result->collection().isNull() && !result->collection()->source().isNull()
&& result->collection()->source()->isLocal() ) && result->collection()->source()->isLocal() )
hasLocalSource = true; {
list.append( item );
break;
}
} }
if ( hasLocalSource )
list.append( item );
} }
m_resultList = list; m_resultList = list;
} }