1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-18 11:51:44 +02:00

DropJob: don't touch iterator after erasing element

Also drops a redundant condition
This commit is contained in:
Lorenz Hübschle-Schneider
2014-10-20 17:05:17 +02:00
parent b6dd736fea
commit 45e6d52db7

View File

@@ -263,9 +263,14 @@ bool
DropJob::validateLocalFiles(const QString &paths, const QString &suffix)
{
QStringList filePaths = paths.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
for ( QStringList::iterator it = filePaths.begin(); it != filePaths.end(); ++it )
QStringList::iterator it = filePaths.begin();
while (it != filePaths.end())
{
if ( !validateLocalFile( *it, suffix ) )
filePaths.erase( it );
it = filePaths.erase( it );
else
++it;
}
return !filePaths.isEmpty();
}
@@ -977,7 +982,7 @@ DropJob::removeRemoteSources()
foreach ( const Tomahawk::result_ptr& result, item->results() )
{
if ( !result->collection().isNull() && !result->collection()->source().isNull() &&
!result->collection()->source().isNull() && result->collection()->source()->isLocal() )
result->collection()->source()->isLocal() )
hasLocalSource = true;
}
if ( hasLocalSource )