diff --git a/packages/snjs/lib/Application/Application.ts b/packages/snjs/lib/Application/Application.ts index aca04f2c1..99e89d454 100644 --- a/packages/snjs/lib/Application/Application.ts +++ b/packages/snjs/lib/Application/Application.ts @@ -284,6 +284,10 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli * This function will load all services in their correct order. */ async prepareForLaunch(callback: LaunchCallback): Promise { + if (this.launched) { + throw new Error('Attempting to prelaunch already launched application') + } + await this.options.crypto.initialize() this.setLaunchCallback(callback) @@ -323,6 +327,10 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli * Option to await database load before marking the app as ready. */ public async launch(awaitDatabaseLoad = false): Promise { + if (this.launched) { + throw new Error('Attempting to launch already launched application') + } + this.launched = false const launchChallenge = this.getLaunchChallenge()