diff --git a/src/core/copyjob.cpp b/src/core/copyjob.cpp --- a/src/core/copyjob.cpp +++ b/src/core/copyjob.cpp @@ -1637,7 +1637,9 @@ it = files.erase(it); } - if ((*it).size > ((1ul << 32) - 1)) { // ((1ul << 32) - 1) = 4 GB + // if _all_ elements in "files" have been skipped, the last files.erase() will return + // files.end(), bug 408350 + if (it != files.end() && (*it).size > ((1ul << 32) - 1)) { // ((1ul << 32) - 1) = 4 GB const auto fileSystem = KFileSystemType::fileSystemType(m_globalDest.toLocalFile()); if (fileSystem == KFileSystemType::Fat) { q->setError(ERR_FILE_TOO_LARGE_FOR_FAT32);