aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Session/SessionManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session/SessionManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index 5181361e3..ec3e636ae 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
@@ -256,7 +256,7 @@ namespace MediaBrowser.Server.Implementations.Session
try
{
- var session = GetSession(sessionId);
+ var session = GetSession(sessionId, false);
if (session != null)
{
@@ -710,13 +710,14 @@ namespace MediaBrowser.Server.Implementations.Session
/// Gets the session.
/// </summary>
/// <param name="sessionId">The session identifier.</param>
+ /// <param name="throwOnMissing">if set to <c>true</c> [throw on missing].</param>
/// <returns>SessionInfo.</returns>
/// <exception cref="ResourceNotFoundException"></exception>
- private SessionInfo GetSession(string sessionId)
+ private SessionInfo GetSession(string sessionId, bool throwOnMissing = true)
{
- var session = Sessions.First(i => string.Equals(i.Id, sessionId));
+ var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId));
- if (session == null)
+ if (session == null && throwOnMissing)
{
throw new ResourceNotFoundException(string.Format("Session {0} not found.", sessionId));
}