Skip to content

Commit d9a9970

Browse files
committed
optimize logic, cleanup code
1 parent 7b9563a commit d9a9970

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/Nager.PublicSuffix/DomainParser.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@ public bool IsValidDomain(string fullyQualifiedDomainName)
102102
return false;
103103
}
104104

105-
var domainDataStructure = this._ruleProvider.GetDomainDataStructure();
106-
if (domainDataStructure == null || domainDataStructure.TldRule == null)
107-
{
108-
return false;
109-
}
110-
111105
if (string.IsNullOrEmpty(domainInfo.Domain))
112106
{
113107
return false;
@@ -136,7 +130,7 @@ public bool IsValidDomain(string fullyQualifiedDomainName)
136130
}
137131

138132
var domainDataStructure = this._ruleProvider.GetDomainDataStructure();
139-
if (domainDataStructure == null)
133+
if (domainDataStructure == null || domainDataStructure.TldRule == null)
140134
{
141135
throw new NullReferenceException("DomainDataStructure is not available");
142136
}

src/Nager.PublicSuffix/RuleParsers/TldRuleParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Nager.PublicSuffix.RuleParsers
99
/// </summary>
1010
public class TldRuleParser
1111
{
12-
private readonly char[] _lineBreak = new char[] { '\n', '\r' };
12+
private readonly char[] _lineBreak = ['\n', '\r'];
1313

1414
/// <summary>
1515
/// ParseRules

src/Nager.PublicSuffix/RuleProviders/StaticRuleProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class StaticRuleProvider : BaseRuleProvider
1616
/// <param name="domainDataStructure"></param>
1717
public StaticRuleProvider(DomainDataStructure domainDataStructure)
1818
{
19-
this._domainDataStructure = domainDataStructure;
19+
base._domainDataStructure = domainDataStructure;
2020
}
2121

2222
/// <summary>

0 commit comments

Comments
 (0)