Skip getting icon if we don't have a server info (#13017)

This commit is contained in:
Charles Gagnon
2020-10-21 15:56:22 -07:00
committed by GitHub
parent 4184c28ce7
commit 656d727854

View File

@@ -573,8 +573,12 @@ export class ConnectionManagementService extends Disposable implements IConnecti
let iconProvider = this._iconProviders.get(connectionManagementInfo.providerId);
if (iconProvider) {
let serverInfo: azdata.ServerInfo = this.getServerInfo(connectionProfile.id);
let profile: interfaces.IConnectionProfile = connectionProfile.toIConnectionProfile();
const serverInfo: azdata.ServerInfo | undefined = this.getServerInfo(connectionProfile.id);
if (!serverInfo) {
this._logService.warn(`Could not find ServerInfo for connection ${connectionProfile.id} when updating icon`);
return;
}
const profile: interfaces.IConnectionProfile = connectionProfile.toIConnectionProfile();
iconProvider.getConnectionIconId(profile, serverInfo).then(iconId => {
if (iconId && this._mementoObj && this._mementoContext) {
if (!this._mementoObj.CONNECTION_ICON_ID) {
@@ -1376,10 +1380,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
if (!profile) {
return undefined;
}
let serverInfo = profile.serverInfo;
return serverInfo;
return profile.serverInfo;
}
public getConnectionProfileById(profileId: string): interfaces.IConnectionProfile {