From ad57ea87aea3e4a2f271b136272e13e8b65c999a Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 26 Apr 2022 16:21:31 +0530 Subject: [PATCH] add missing checks before using newer APIs --- src/services/importService.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/services/importService.ts b/src/services/importService.ts index 2f3d1872a..5feb85b81 100644 --- a/src/services/importService.ts +++ b/src/services/importService.ts @@ -86,7 +86,9 @@ class ImportService { type: DESKTOP_UPLOAD_TYPE.FILES | DESKTOP_UPLOAD_TYPE.ZIPS, filePaths: string[] ) { - this.ElectronAPIs.setToUploadFiles(type, filePaths); + if (this.allElectronAPIsExist) { + this.ElectronAPIs.setToUploadFiles(type, filePaths); + } } updatePendingUploads(files: FileWithCollection[]) { @@ -114,9 +116,11 @@ class ImportService { } } cancelRemainingUploads() { - this.ElectronAPIs.setToUploadCollection(null); - this.ElectronAPIs.setToUploadFiles(DESKTOP_UPLOAD_TYPE.ZIPS, []); - this.ElectronAPIs.setToUploadFiles(DESKTOP_UPLOAD_TYPE.FILES, []); + if (this.allElectronAPIsExist) { + this.ElectronAPIs.setToUploadCollection(null); + this.ElectronAPIs.setToUploadFiles(DESKTOP_UPLOAD_TYPE.ZIPS, []); + this.ElectronAPIs.setToUploadFiles(DESKTOP_UPLOAD_TYPE.FILES, []); + } } }