From 8fa62fe519c55bdac9f0b54a8e8eaa0290d15c65 Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Tue, 11 Jul 2023 17:00:18 -0700 Subject: [PATCH] Adding null checks in disconnecting connections from async tree (#23636) * Adding null checks in disconnecting connections * Fixing stuff * Update src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts Co-authored-by: Charles Gagnon --------- Co-authored-by: Charles Gagnon --- .../contrib/objectExplorer/browser/serverTreeView.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts b/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts index 7faeeb0b79..56571eb46d 100644 --- a/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts +++ b/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts @@ -527,7 +527,10 @@ export class ServerTreeView extends Disposable implements IServerTreeView { await this._connectionManagementService.deleteConnection(profile); } const connectionProfile = this.getConnectionInTreeInput(profile.id); - + // If the connection is not found in the tree, it means it was already deleted from the tree and we don't need to disconnect it + if (!connectionProfile) { + return; + } // For the connection profile, we need to clear the password from the last session if the user doesn't want to save it if (!connectionProfile.savePassword) { connectionProfile.password = '';