fix: NullReferenceException

This commit is contained in:
AnonymousDotNet 2024-11-05 11:08:18 +08:00
parent fd0897019b
commit f521a4de9e

View file

@ -49,7 +49,7 @@ public class UserViewModel
FirstName = user.FirstName,
LastName = user.LastName,
Email = user.Email,
Phone = user.Phone?.Substring(0, 3) == "+86" ? user.Phone.Substring(3) : user.Phone,
Phone = (!string.IsNullOrWhiteSpace(user.Phone) && user.Phone.Length > 3) ? (user.Phone.Substring(0, 3) == "+86" ? user.Phone.Substring(3) : user.Phone) : user.Phone,
Type = user.Type,
Role = user.Role,
Source = user.Source,