fix null reference in web socket connection

This commit is contained in:
Luke Pulverenti 2015-03-09 21:47:52 -04:00
parent 7fdc6e7e91
commit a11c4d0b08

View File

@ -99,6 +99,10 @@ namespace MediaBrowser.Server.Implementations.Session
private Task<SessionInfo> GetSession(NameValueCollection queryString, string remoteEndpoint) private Task<SessionInfo> GetSession(NameValueCollection queryString, string remoteEndpoint)
{ {
var token = queryString["api_key"]; var token = queryString["api_key"];
if (string.IsNullOrWhiteSpace(token))
{
return Task.FromResult<SessionInfo>(null);
}
return _sessionManager.GetSessionByAuthenticationToken(token, remoteEndpoint); return _sessionManager.GetSessionByAuthenticationToken(token, remoteEndpoint);
} }