From 755a8d573eb76775f4c8f5b2d3345e242c34954e Mon Sep 17 00:00:00 2001 From: IDCs Date: Tue, 1 Oct 2024 14:31:04 +0100 Subject: [PATCH 1/2] fixed attempts to import local downloads when no game is active fixes nexus-mods/vortex#16363 --- src/extensions/download_management/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/extensions/download_management/index.ts b/src/extensions/download_management/index.ts index 6f4be76c3..ae652022c 100644 --- a/src/extensions/download_management/index.ts +++ b/src/extensions/download_management/index.ts @@ -410,6 +410,9 @@ function postImport(api: IExtensionApi, destination: string, fileSize: number, silent: boolean): Promise { const store = api.store; const gameMode = selectors.activeGameId(store.getState()); + if (gameMode === undefined) { + throw new Error('no active game'); + } const dlId = shortid(); const fileName = path.basename(destination); @@ -477,6 +480,7 @@ function move(api: IExtensionApi, .then(() => fs.copyAsync(source, destination)) .then(() => postImport(api, destination, fileSize, silent)) .catch(err => { + api.showErrorNotification('Import Failed', err, { allowReport: false }); log('info', 'failed to copy', {error: err.message}); return undefined; }) @@ -507,6 +511,7 @@ function importDirectory(api: IExtensionApi, .then(() => fs.statAsync(destination)) .then((stat: fs.Stats) => postImport(api, destination, stat.size, silent)) .catch(err => { + api.showErrorNotification('Import Failed', err, { allowReport: false }); log('info', 'failed to copy', {error: err.message}); return undefined; }) From c3d29ae40a69db4370f523a415f6675fa922ba3f Mon Sep 17 00:00:00 2001 From: IDCs Date: Tue, 1 Oct 2024 14:42:43 +0100 Subject: [PATCH 2/2] minor fix --- src/extensions/download_management/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extensions/download_management/index.ts b/src/extensions/download_management/index.ts index ae652022c..906903d18 100644 --- a/src/extensions/download_management/index.ts +++ b/src/extensions/download_management/index.ts @@ -411,7 +411,7 @@ function postImport(api: IExtensionApi, destination: string, const store = api.store; const gameMode = selectors.activeGameId(store.getState()); if (gameMode === undefined) { - throw new Error('no active game'); + return Promise.reject(new Error('no active game')); } const dlId = shortid();