diff --git a/src/sql/platform/connection/common/connectionConfig.ts b/src/sql/platform/connection/common/connectionConfig.ts index db7e0a535c..18b7ce7709 100644 --- a/src/sql/platform/connection/common/connectionConfig.ts +++ b/src/sql/platform/connection/common/connectionConfig.ts @@ -116,7 +116,7 @@ export class ConnectionConfig { return this.configurationService.updateValue(CONNECTIONS_CONFIG_KEY, profiles, ConfigurationTarget.USER).then(() => { profiles.forEach(p => { - if (isDisposable(p)) { + if (p && isDisposable(p)) { p.dispose(); } }); diff --git a/src/sql/platform/connection/common/connectionStore.ts b/src/sql/platform/connection/common/connectionStore.ts index a2089d4c11..2e2c3aa630 100644 --- a/src/sql/platform/connection/common/connectionStore.ts +++ b/src/sql/platform/connection/common/connectionStore.ts @@ -113,7 +113,7 @@ export class ConnectionStore { // Add the profile to the saved list, taking care to clear out the password field if necessary const savedProfile = forceWritePlaintextPassword ? profile : this.getProfileWithoutPassword(profile); const savedConnectionProfile = await this.saveProfileToConfig(savedProfile, matcher); - if (isDisposable(savedProfile)) { + if (savedProfile && isDisposable(savedProfile)) { savedProfile.dispose(); } profile.groupId = savedConnectionProfile.groupId; diff --git a/src/sql/workbench/services/objectExplorer/browser/treeUpdateUtils.ts b/src/sql/workbench/services/objectExplorer/browser/treeUpdateUtils.ts index 9fb467428c..e8912c3969 100644 --- a/src/sql/workbench/services/objectExplorer/browser/treeUpdateUtils.ts +++ b/src/sql/workbench/services/objectExplorer/browser/treeUpdateUtils.ts @@ -128,7 +128,7 @@ export class TreeUpdateUtils { const originalInput = tree.getInput(); if (treeInput !== originalInput) { return tree.setInput(treeInput).then(async () => { - if (isDisposable(originalInput)) { + if (originalInput && isDisposable(originalInput)) { originalInput.dispose(); } // Make sure to expand all folders that where expanded in the previous session