Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Fix "Sequence contains no elements" error.
Browse files Browse the repository at this point in the history
  • Loading branch information
stackia committed Jun 4, 2015
1 parent 0651d91 commit ea3505f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions DNSAgent/DnsMessageCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ internal class DnsCacheMessageEntry
public DnsCacheMessageEntry(DnsMessage message, int timeToLive)
{
Message = message;
timeToLive =
Math.Max(message.AnswerRecords.Concat(message.AuthorityRecords).Min(record => record.TimeToLive),
timeToLive);
var records = message.AnswerRecords.Concat(message.AuthorityRecords).ToList();
if (records.Any())
timeToLive = Math.Max(records.Min(record => record.TimeToLive), timeToLive);
ExpireTime = DateTime.Now.AddSeconds(timeToLive);
}

Expand Down

0 comments on commit ea3505f

Please sign in to comment.