backuptask: fix crash when (old) stats object has no copy field

This commit is contained in:
Girish Ramakrishnan
2025-11-13 14:42:38 +01:00
parent 6305ff7410
commit b8f486d8e4
+1 -1
View File
@@ -319,7 +319,7 @@ async function backupBox(backupSite, appBackupsMap, tag, options, progressCallba
if (!error) {
stats.copy = { startTime: copyStartTime, duration: Date.now() - copyStartTime };
// stats object might be null for stopped/errored apps from old versions
stats.aggregatedCopy = Array.from(appBackupsMap.values()).filter(s => !!s).reduce((acc, cur) => ({
stats.aggregatedCopy = Array.from(appBackupsMap.values()).filter(s => !!s?.copy).reduce((acc, cur) => ({
startTime: Math.min(acc.startTime, cur.copy.startTime),
duration: acc.duration + cur.copy.duration,
}), stats.copy);