The Free Software Media System - Server Backend & API
add null checks on session & device creation
Luke Pulverentica100ff2d13b
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.csindex 6b1af8d2d9..c3db9140cf 100644--- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs+++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs@@ -51,6 +51,11 @@ namespace MediaBrowser.Server.Implementations.Devicespublic async Task<DeviceInfo> RegisterDevice(string reportedId, string name, string appName, string appVersion, string usedByUserId){+ if (string.IsNullOrWhiteSpace(reportedId))+ {+ throw new ArgumentNullException("reportedId");+ }+var device = GetDevice(reportedId) ?? new DeviceInfo{Id = reportedIddiff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.csindex 0dabcac4be..4386b785ad 100644--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs@@ -404,6 +404,10 @@ namespace MediaBrowser.Server.Implementations.Session/// <returns>SessionInfo.</returns>private async Task<SessionInfo> GetSessionInfo(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user){+ if (string.IsNullOrWhiteSpace(deviceId))+ {+ throw new ArgumentNullException("deviceId");+ }var key = GetSessionKey(appName, deviceId);await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false);