diff --git a/test/syncenginetestutils.cpp b/test/syncenginetestutils.cpp index 98519731c7..80e662f462 100644 --- a/test/syncenginetestutils.cpp +++ b/test/syncenginetestutils.cpp @@ -159,8 +159,13 @@ void FileInfo::remove(const QString &relativePath) const PathComponents pathComponents { relativePath }; FileInfo *parent = findInvalidatingEtags(pathComponents.parentDirComponents()); Q_ASSERT(parent); - parent->children.erase(std::find_if(parent->children.begin(), parent->children.end(), - [&pathComponents](const FileInfo &fi) { return fi.name == pathComponents.fileName(); })); + auto childrenIt = std::find_if(parent->children.begin(), parent->children.end(), + [&pathComponents](const FileInfo &fi) { + return fi.name == pathComponents.fileName(); + }); + if (childrenIt != parent->children.end()) { + parent->children.erase(childrenIt); + } } void FileInfo::insert(const QString &relativePath, qint64 size, char contentChar) diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 746f4c133e..f0d55d86d6 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -1700,8 +1700,7 @@ private slots: conflicts = findCaseClashConflicts(fakeFolder.currentLocalState()); QCOMPARE(conflicts.size(), 0); - // remove both files from the server(lower and UPPER case) - fakeFolder.remoteModifier().remove(testLowerCaseFile); + // remove the other file fakeFolder.remoteModifier().remove(testUpperCaseFile); QVERIFY(fakeFolder.syncOnce()); }