From 025684407480934eb8bac81eb53ce80744ee3e2d Mon Sep 17 00:00:00 2001 From: AnonymousDotNet <18776095145@163.com> Date: Wed, 30 Oct 2024 18:22:24 +0800 Subject: [PATCH] fix: NullReferenceException --- .../Repository/MongoRepository.User.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.User.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.User.cs index 33cd16e8..7c19dc2a 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.User.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.User.cs @@ -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}"; }