aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-30 12:22:31 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-30 12:22:31 -0400
commitca100ff2d13b0bf885826e02e7c1ed6a4496694e (patch)
tree902256fd0ab6fccb07b1c4a5c04ad1768a03d61a
parentf8a0cf4637dec1ed1369882194bf7810d9840ccf (diff)
add null checks on session & device creation
-rw-r--r--MediaBrowser.Server.Implementations/Devices/DeviceManager.cs5
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs4
2 files changed, 9 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
index 6b1af8d2d..c3db9140c 100644
--- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
+++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
@@ -51,6 +51,11 @@ namespace MediaBrowser.Server.Implementations.Devices
public 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 = reportedId
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index 0dabcac4b..4386b785a 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);