Explorar o código

fix user media permission

Luke Pulverenti %!s(int64=11) %!d(string=hai) anos
pai
achega
6cfc103bd3
Modificáronse 1 ficheiros con 14 adicións e 11 borrados
  1. 14 11
      MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs

+ 14 - 11
MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs

@@ -98,17 +98,20 @@ namespace MediaBrowser.Api
         {
             var auth = GetAuthorizationDictionary(httpReq);
 
-            string userId;
-            string deviceId;
-            string device;
-            string client;
-            string version;
-
-            auth.TryGetValue("UserId", out userId);
-            auth.TryGetValue("DeviceId", out deviceId);
-            auth.TryGetValue("Device", out device);
-            auth.TryGetValue("Client", out client);
-            auth.TryGetValue("Version", out version);
+            string userId = null;
+            string deviceId = null;
+            string device = null;
+            string client = null;
+            string version = null;
+
+            if (auth != null)
+            {
+                auth.TryGetValue("UserId", out userId);
+                auth.TryGetValue("DeviceId", out deviceId);
+                auth.TryGetValue("Device", out device);
+                auth.TryGetValue("Client", out client);
+                auth.TryGetValue("Version", out version);
+            }
 
             return new AuthorizationInfo
             {