-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
I'm noticing an illegal opperation and a crash happening on the latest current commit on main, 0be9d19
On this line:
WebDAV-Swift/Sources/WebDAV/WebDAV.swift
Line 545 in 0be9d19
| filesCache.removeValue(forKey: key) |
I noticed you are iterating over a collection and at the same time removing a value. That's a problem.
Quick fix is to iterate over a copy of the collection and remove the value from the original collection to avoid the crash.
let tempFilesCache = filesCache //because we want to remove a value, so we can't iterate and remove at the same time.
for (key, _) in tempFilesCache where key.path != directory && key.path.starts(with: directory) && !files.contains(where: { key.path.starts(with: $0.path.trimmingCharacters(in: AccountPath.slash)) }) {
filesCache.removeValue(forKey: key)
changed = true
}
Metadata
Metadata
Assignees
Labels
No labels