李昊 4 gadi atpakaļ
vecāks
revīzija
903b16ed0d

+ 4 - 1
GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -117,10 +117,13 @@ namespace GxPress.Repository.Implement
         {
             if (id <= 0) return string.Empty;
 
-            return await _repository.GetAsync<string>(Q
+            var result = await _repository.GetAsync<string>(Q
                 .Select(nameof(User.Name))
                 .Where(nameof(User.Id), id)
             );
+            if (string.IsNullOrWhiteSpace(result))
+                return string.Empty;
+            return result;
         }
 
         public async Task<string> GetAvatarUrlAsync(int id)