From 3268de0edfaceeee41724ed05af26c4b0d2add1d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 28 Jan 2016 22:42:03 -0500 Subject: [PATCH] add null check to PeriodicTimer --- MediaBrowser.Common/Threading/PeriodicTimer.cs | 5 +++++ .../Connect/ConnectEntryPoint.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Common/Threading/PeriodicTimer.cs b/MediaBrowser.Common/Threading/PeriodicTimer.cs index cb562a80dc..75ccada4ef 100644 --- a/MediaBrowser.Common/Threading/PeriodicTimer.cs +++ b/MediaBrowser.Common/Threading/PeriodicTimer.cs @@ -14,6 +14,11 @@ namespace MediaBrowser.Common.Threading public PeriodicTimer(Action callback, object state, TimeSpan dueTime, TimeSpan period) { + if (callback == null) + { + throw new ArgumentNullException("callback"); + } + Callback = callback; _period = period; _state = state; diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index 0d6b8ac26c..12de5f6ef1 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -44,7 +44,7 @@ namespace MediaBrowser.Server.Implementations.Connect { Task.Run(() => LoadCachedAddress()); - _timer = new PeriodicTimer(null, new TimerCallback(TimerCallback), TimeSpan.FromSeconds(5), TimeSpan.FromHours(3)); + _timer = new PeriodicTimer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3)); } private readonly string[] _ipLookups = { "http://bot.whatismyipaddress.com", "https://connect.emby.media/service/ip" };