diff --git a/src/coreservices.cpp b/src/coreservices.cpp index 703fab5765a..1acc24077d1 100644 --- a/src/coreservices.cpp +++ b/src/coreservices.cpp @@ -441,9 +441,8 @@ void CoreServices::initialize(QApplication* pApp) { // Load tracks in args.qlMusicFiles (command line arguments) into player // 1 and 2: const QList& musicFiles = m_cmdlineArgs.getMusicFiles(); - for (int i = 0; i < m_pPlayerManager->numberOfDecks() && - i < musicFiles.count(); - ++i) { + const int numTracks = std::min(m_pPlayerManager->numberOfDecks(), musicFiles.count()); + for (int i = 0; i < numTracks; ++i) { if (SoundSourceProxy::isFileNameSupported(musicFiles.at(i))) { m_pPlayerManager->slotLoadToDeck(musicFiles.at(i), i + 1); }