From a3f27580838c05e4f8efdad5fd4a78083a635200 Mon Sep 17 00:00:00 2001 From: nuryagdym Date: Wed, 10 Feb 2021 11:33:58 +0300 Subject: [PATCH] Update downloadPlanBuilder.ts fix issue #5622 Cannot read property 'log' of undefined --- .../src/differentialDownloader/downloadPlanBuilder.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/electron-updater/src/differentialDownloader/downloadPlanBuilder.ts b/packages/electron-updater/src/differentialDownloader/downloadPlanBuilder.ts index 57b19f2cf2c..39b1925bd01 100644 --- a/packages/electron-updater/src/differentialDownloader/downloadPlanBuilder.ts +++ b/packages/electron-updater/src/differentialDownloader/downloadPlanBuilder.ts @@ -110,7 +110,6 @@ function buildChecksumMap(file: BlockMapFile, fileOffset: number, logger: Logger const checksumToOffset = new Map() const checksumToSize = new Map() let offset = fileOffset - const debugLog = logger.debug for (let i = 0; i < file.checksums.length; i++) { const checksum = file.checksums[i] const size = file.sizes[i] @@ -120,9 +119,9 @@ function buildChecksumMap(file: BlockMapFile, fileOffset: number, logger: Logger checksumToOffset.set(checksum, offset) checksumToSize.set(checksum, size) } - else if (debugLog != null) { + else if (logger.debug != null) { const sizeExplanation = existing === size ? "(same size)" : `(size: ${existing}, this size: ${size})` - debugLog(`${checksum} duplicated in blockmap ${sizeExplanation}, it doesn't lead to broken differential downloader, just corresponding block will be skipped)`) + logger.debug(`${checksum} duplicated in blockmap ${sizeExplanation}, it doesn't lead to broken differential downloader, just corresponding block will be skipped)`) } offset += size }