From 83a8b137505e407267c83b59a12713265b586081 Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Fri, 12 Jun 2020 12:46:34 -0700 Subject: [PATCH] If the connectionProfile was undefined, then return undefined (#10899) --- .../api/browser/mainThreadConnectionManagement.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sql/workbench/api/browser/mainThreadConnectionManagement.ts b/src/sql/workbench/api/browser/mainThreadConnectionManagement.ts index 11bb1faf66..b51f65879b 100644 --- a/src/sql/workbench/api/browser/mainThreadConnectionManagement.ts +++ b/src/sql/workbench/api/browser/mainThreadConnectionManagement.ts @@ -128,7 +128,7 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh return Promise.resolve(this._connectionManagementService.getServerInfo(connectionId)); } - public async $openConnectionDialog(providers: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Promise { + public async $openConnectionDialog(providers: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Promise { // Here we default to ConnectionType.editor which saves the connecton in the connection store by default let connectionType = ConnectionType.editor; @@ -139,9 +139,12 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh } let connectionProfile = await this._connectionDialogService.openDialogAndWait(this._connectionManagementService, { connectionType: connectionType, providers: providers }, initialConnectionProfile, undefined); - if (connectionProfile) { - connectionProfile.options.savePassword = connectionProfile.savePassword; + + if (!connectionProfile) { + return undefined; } + + connectionProfile.options.savePassword = connectionProfile.savePassword; const connection = connectionProfile ? { connectionId: connectionProfile.id, options: connectionProfile.options,