Skip to content

Commit

Permalink
fixed attempts to import local downloads when no game is active
Browse files Browse the repository at this point in the history
fixes #16363
  • Loading branch information
IDCs committed Oct 1, 2024
1 parent 58aa764 commit 755a8d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/extensions/download_management/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ function postImport(api: IExtensionApi, destination: string,
fileSize: number, silent: boolean): Promise<string> {
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);
Expand Down Expand Up @@ -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;
})
Expand Down Expand Up @@ -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;
})
Expand Down

0 comments on commit 755a8d5

Please sign in to comment.