Merge pull request #1274 from bugfixin/content-type-fix

Prevent null reference when request content type is x-www-form-urlencoded
This commit is contained in:
Bond-009 2019-04-24 14:54:18 +02:00 committed by GitHub
commit a0e61ee67f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,10 @@ namespace Emby.Server.Implementations.Services
if (!string.IsNullOrEmpty(contentType) && httpReq.ContentLength > 0) if (!string.IsNullOrEmpty(contentType) && httpReq.ContentLength > 0)
{ {
var deserializer = RequestHelper.GetRequestReader(host, contentType); var deserializer = RequestHelper.GetRequestReader(host, contentType);
return deserializer?.Invoke(requestType, httpReq.InputStream); if (deserializer != null)
{
return deserializer.Invoke(requestType, httpReq.InputStream);
}
} }
return Task.FromResult(host.CreateInstance(requestType)); return Task.FromResult(host.CreateInstance(requestType));