Fix nullref exception in connection profile (#5330)

* Fix nullref exception in connection profile

* Fix condition
This commit is contained in:
Karl Burtram
2019-05-02 16:04:03 -07:00
committed by GitHub
parent 1bfdce9642
commit 188ccf849d

View File

@@ -58,14 +58,19 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
public matches(other: interfaces.IConnectionProfile): boolean {
return other
&& this.providerName === other.providerName
&& equalsIgnoreCase(this.serverName, other.serverName)
&& equalsIgnoreCase(this.databaseName, other.databaseName)
&& equalsIgnoreCase(this.userName, other.userName)
&& equalsIgnoreCase(this.options['databaseDisplayName'], other.options['databaseDisplayName'])
&& this.nullCheckEqualsIgnoreCase(this.serverName, other.serverName)
&& this.nullCheckEqualsIgnoreCase(this.databaseName, other.databaseName)
&& this.nullCheckEqualsIgnoreCase(this.userName, other.userName)
&& this.nullCheckEqualsIgnoreCase(this.options['databaseDisplayName'], other.options['databaseDisplayName'])
&& this.authenticationType === other.authenticationType
&& this.groupId === other.groupId;
}
private nullCheckEqualsIgnoreCase(a: string, b: string) {
let bothNull: boolean = !a && !b;
return bothNull ? bothNull : equalsIgnoreCase(a, b);
}
public generateNewId() {
this._id = generateUuid();
}