mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-07 10:14:14 -04:00
add null checks on session & device creation
This commit is contained in:
parent
f8a0cf4637
commit
ca100ff2d1
@ -51,6 +51,11 @@ namespace MediaBrowser.Server.Implementations.Devices
|
|||||||
|
|
||||||
public async Task<DeviceInfo> RegisterDevice(string reportedId, string name, string appName, string appVersion, string usedByUserId)
|
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
|
var device = GetDevice(reportedId) ?? new DeviceInfo
|
||||||
{
|
{
|
||||||
Id = reportedId
|
Id = reportedId
|
||||||
|
@ -404,6 +404,10 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||||||
/// <returns>SessionInfo.</returns>
|
/// <returns>SessionInfo.</returns>
|
||||||
private async Task<SessionInfo> GetSessionInfo(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user)
|
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);
|
var key = GetSessionKey(appName, deviceId);
|
||||||
|
|
||||||
await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false);
|
await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user