mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 01:24:11 +02:00
Guard first() calls in music scanner
This commit is contained in:
@@ -224,8 +224,11 @@ MusicScanner::postOps()
|
|||||||
{
|
{
|
||||||
// any remaining stuff that wasnt emitted as a batch:
|
// any remaining stuff that wasnt emitted as a batch:
|
||||||
foreach( const QString& key, m_filemtimes.keys() )
|
foreach( const QString& key, m_filemtimes.keys() )
|
||||||
|
{
|
||||||
|
if ( !m_filemtimes[ key ].keys().isEmpty() )
|
||||||
m_filesToDelete << m_filemtimes[ key ].keys().first();
|
m_filesToDelete << m_filemtimes[ key ].keys().first();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tDebug( LOGINFO ) << "Scanning complete, saving to database. ( deleted" << m_filesToDelete.count() << "- scanned" << m_scanned << "- skipped" << m_skipped << ")";
|
tDebug( LOGINFO ) << "Scanning complete, saving to database. ( deleted" << m_filesToDelete.count() << "- scanned" << m_scanned << "- skipped" << m_skipped << ")";
|
||||||
tDebug( LOGEXTRA ) << "Skipped the following files (no tags / no valid audio):";
|
tDebug( LOGEXTRA ) << "Skipped the following files (no tags / no valid audio):";
|
||||||
@@ -303,12 +306,14 @@ MusicScanner::scanFile( const QFileInfo& fi )
|
|||||||
{
|
{
|
||||||
if ( m_filemtimes.contains( "file://" + fi.canonicalFilePath() ) )
|
if ( m_filemtimes.contains( "file://" + fi.canonicalFilePath() ) )
|
||||||
{
|
{
|
||||||
if ( fi.lastModified().toUTC().toTime_t() == m_filemtimes.value( "file://" + fi.canonicalFilePath() ).values().first() )
|
if ( !m_filemtimes.value( "file://" + fi.canonicalFilePath() ).values().isEmpty() &&
|
||||||
|
fi.lastModified().toUTC().toTime_t() == m_filemtimes.value( "file://" + fi.canonicalFilePath() ).values().first() )
|
||||||
{
|
{
|
||||||
m_filemtimes.remove( "file://" + fi.canonicalFilePath() );
|
m_filemtimes.remove( "file://" + fi.canonicalFilePath() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !m_filemtimes.value( "file://" + fi.canonicalFilePath() ).keys().isEmpty() )
|
||||||
m_filesToDelete << m_filemtimes.value( "file://" + fi.canonicalFilePath() ).keys().first();
|
m_filesToDelete << m_filemtimes.value( "file://" + fi.canonicalFilePath() ).keys().first();
|
||||||
m_filemtimes.remove( "file://" + fi.canonicalFilePath() );
|
m_filemtimes.remove( "file://" + fi.canonicalFilePath() );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user