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 <chgagnon@microsoft.com>

---------

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
Aasim Khan
2023-07-11 17:00:18 -07:00
committed by GitHub
parent 4959bce50b
commit 8fa62fe519

View File

@@ -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 = '';