[Fix] Missing null checks in RoleConnectionProperties (#2759)

* add null check

* more null checks
This commit is contained in:
Mihail Gribkov
2023-11-18 23:50:55 +03:00
committed by GitHub
parent 5cfec056cb
commit ab3b30dee4

View File

@@ -120,13 +120,16 @@ public class RoleConnectionProperties
{ {
PlatformName = platformName; PlatformName = platformName;
PlatformUsername = platformUsername; PlatformUsername = platformUsername;
Metadata = metadata.ToDictionary(); Metadata = metadata?.ToDictionary() ?? new ();
} }
/// <summary> /// <summary>
/// Initializes a new instance of <see cref="RoleConnectionProperties"/>. /// Initializes a new instance of <see cref="RoleConnectionProperties"/>.
/// </summary> /// </summary>
public RoleConnectionProperties() { } public RoleConnectionProperties()
{
Metadata = new();
}
/// <summary> /// <summary>
/// Initializes a new <see cref="RoleConnectionProperties"/> with the data from provided <see cref="RoleConnection"/>. /// Initializes a new <see cref="RoleConnectionProperties"/> with the data from provided <see cref="RoleConnection"/>.
@@ -136,6 +139,6 @@ public class RoleConnectionProperties
{ {
PlatformName = roleConnection.PlatformName, PlatformName = roleConnection.PlatformName,
PlatformUsername = roleConnection.PlatformUsername, PlatformUsername = roleConnection.PlatformUsername,
Metadata = roleConnection.Metadata.ToDictionary() Metadata = roleConnection.Metadata?.ToDictionary()
}; };
} }