From a3e77c674cb28136391aa14cd4cf48eef59b867e Mon Sep 17 00:00:00 2001 From: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Date: Wed, 22 Mar 2023 12:31:25 -0700 Subject: [PATCH] Address console warnings with new connection dialog (#22293) --- .../services/connection/browser/connectionWidget.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sql/workbench/services/connection/browser/connectionWidget.ts b/src/sql/workbench/services/connection/browser/connectionWidget.ts index a28acbe4a5..bc88df3d88 100644 --- a/src/sql/workbench/services/connection/browser/connectionWidget.ts +++ b/src/sql/workbench/services/connection/browser/connectionWidget.ts @@ -957,7 +957,7 @@ export class ConnectionWidget extends lifecycle.Disposable { await this.onAzureAccountSelected(); let tenantId = connectionInfo.azureTenantId; - if (account && account.properties.tenants && account.properties.tenants.length > 1) { + if (account && tenantId && account.properties.tenants && account.properties.tenants.length > 1) { let tenant = account.properties.tenants.find(tenant => tenant.id === tenantId); if (tenant) { this._azureTenantDropdown.selectWithOptionName(tenant.displayName); @@ -966,7 +966,9 @@ export class ConnectionWidget extends lifecycle.Disposable { // This should ideally never ever happen! this._logService.error(`fillInConnectionInputs : Could not find tenant with ID ${this._azureTenantId} for account ${accountName}`); } - this.onAzureTenantSelected(this._azureTenantDropdown.values.indexOf(this._azureTenantDropdown.value)); + if (this._azureTenantDropdown.value) { + this.onAzureTenantSelected(this._azureTenantDropdown.values.indexOf(this._azureTenantDropdown.value)); + } } else if (account && account.properties.tenants && account.properties.tenants.length === 1) { this._azureTenantId = account.properties.tenants[0].id;