From 87cb90c9b6a54a9a39826dfcf0c8c9956c483a30 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 8 Apr 2022 16:27:11 -0700 Subject: [PATCH] Fix crash ReferenceError: Cannot access 'backups' before initialization --- src/apps.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps.js b/src/apps.js index 03271a8bc..b47131a0b 100644 --- a/src/apps.js +++ b/src/apps.js @@ -2477,11 +2477,11 @@ async function restoreInstalledApps(options, auditSource) { apps = apps.filter(app => app.installationState !== exports.ISTATE_PENDING_RESTORE); // safeguard against tasks being created non-stop if we crash on startup for (const app of apps) { - const [error, backups] = await safe(backups.getByIdentifierAndStatePaged(app.id, backups.BACKUP_STATE_NORMAL, 1, 1)); + const [error, result] = await safe(backups.getByIdentifierAndStatePaged(app.id, backups.BACKUP_STATE_NORMAL, 1, 1)); let installationState, restoreConfig, oldManifest; - if (!error && backups.length) { + if (!error && result.length) { installationState = exports.ISTATE_PENDING_RESTORE; - restoreConfig = { remotePath: backups[0].remotePath, backupFormat: backups[0].format }; + restoreConfig = { remotePath: result[0].remotePath, backupFormat: result[0].format }; oldManifest = app.manifest; } else { installationState = exports.ISTATE_PENDING_INSTALL;