Skip to content

Commit 44c1a9e

Browse files
Fixed crash when comparing files with different sizes
1 parent 31f2260 commit 44c1a9e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

urlwatcher/Sources/urlwatcher/main.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ for entry in config {
169169
if fileManager.fileExists(atPath: diffFile) {
170170
try fileManager.removeItem(atPath: diffFile)
171171
}
172-
try fileManager.moveItem(atPath: tempDiff, toPath: diffFile)
172+
// The temp file could not exist, in case we only report a change due to size difference
173+
// (then the compare command never successfully compared the files)
174+
if fileManager.fileExists(atPath: tempDiff) {
175+
try fileManager.moveItem(atPath: tempDiff, toPath: diffFile)
176+
}
173177

174178
// Generate detailed NCC information
175179
let nccFile = "\(entryPath)/\(nccFilename)"

0 commit comments

Comments
 (0)