mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
Erase elements from QStringList safely
This commit is contained in:
@@ -263,9 +263,14 @@ bool
|
|||||||
DropJob::validateLocalFiles(const QString &paths, const QString &suffix)
|
DropJob::validateLocalFiles(const QString &paths, const QString &suffix)
|
||||||
{
|
{
|
||||||
QStringList filePaths = paths.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
|
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 ) )
|
if ( !validateLocalFile( *it, suffix ) )
|
||||||
filePaths.erase( it );
|
it = filePaths.erase( it );
|
||||||
|
else
|
||||||
|
++it;
|
||||||
|
}
|
||||||
return !filePaths.isEmpty();
|
return !filePaths.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user