From 3f9a412b027667d2eabd3b05db2789e732a9a3ff Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 13 Apr 2013 15:40:49 -0400 Subject: [PATCH] fix user request logging --- MediaBrowser.Api/BaseApiService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 8fcef654dd..e644f1f313 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -110,9 +110,14 @@ namespace MediaBrowser.Api if (auth != null && auth.ContainsKey("UserId")) { - var user = UserManager.GetUserById(new Guid(auth["UserId"])); + var userId = auth["UserId"]; - UserManager.LogUserActivity(user, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty); + if (!string.IsNullOrEmpty(userId)) + { + var user = UserManager.GetUserById(new Guid(userId)); + + UserManager.LogUserActivity(user, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty); + } } }