null check before calling isDisposable (#17959)

This commit is contained in:
Alan Ren
2021-12-17 09:56:04 -08:00
committed by GitHub
parent 8aa6a8ac95
commit d8467f2c1a
3 changed files with 3 additions and 3 deletions

View File

@@ -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();
}
});

View File

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