fix: NullReferenceException

This commit is contained in:
AnonymousDotNet 2024-10-30 18:22:24 +08:00
parent e31942c656
commit 0256844074

View file

@ -14,7 +14,7 @@ public partial class MongoRepository
public User? GetUserByPhone(string phone)
{
string phoneSecond = string.Empty;
if (phone.Substring(0, 3) != "+86")
if (phone.Length >= 4 && phone.Substring(0, 3) != "+86")
{
phoneSecond = $"+86{phone}";
}