fix issue with empty connection (#5602)

This commit is contained in:
Anthony Dresser
2019-05-23 16:07:28 -07:00
committed by GitHub
parent 7b01a6ca61
commit db5a0a892a
2 changed files with 6 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
this.saveProfile = model.saveProfile;
this._id = model.id;
this.azureTenantId = model.azureTenantId;
if (this.capabilitiesService) {
if (this.capabilitiesService && model.providerName) {
const options = this.capabilitiesService.getCapabilities(model.providerName).connection.connectionOptions;
let appNameOption = options.find(option => option.specialValueType === ConnectionOptionSpecialType.appName);
if (appNameOption) {

View File

@@ -214,4 +214,8 @@ suite('SQL ConnectionProfileInfo tests', () => {
assert.notEqual(newProfile.id, conn.id);
assert.equal(newProfile.databaseName, 'new db');
});
test('an empty connection profile does not cause issues', () => {
assert.doesNotThrow(() => new ConnectionProfile(capabilitiesService, {} as IConnectionProfile));
});
});