Skip to content

Commit bec164c

Browse files
authored
Avoid adding null Origin to Origins. Fixes #283. (#296)
1 parent 061ffc9 commit bec164c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Src/Fido2.Models/Fido2Configuration.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,24 @@ public class Fido2Configuration
4848
/// </summary>
4949
public HashSet<string> Origins
5050
{
51-
get => _origins ?? new HashSet<string>
51+
get
5252
{
53-
#pragma warning disable CS0618
54-
Origin
55-
#pragma warning restore CS0618
56-
};
53+
if (_origins == null)
54+
{
55+
_origins = new HashSet<string>();
56+
57+
// Since we're depricating Origin we ease the transition to move the value automatically, unless its null
58+
#pragma warning disable CS0618 // Type or member is obsolete
59+
if (Origin != null)
60+
{
61+
_origins.Add(Origin);
62+
}
63+
#pragma warning restore CS0618 // Type or member is obsolete
64+
}
65+
66+
return _origins;
67+
}
68+
5769
set
5870
{
5971
_origins = value;

0 commit comments

Comments
 (0)