From 7b36d43e5e0dd8143a72dc2ee9dcbfc6a39fca40 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Mon, 1 Sep 2025 17:36:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=94=99=E8=AF=AF=E7=9A=84=E5=85=B3?= =?UTF-8?q?=E5=8D=A1=E5=90=8D=E5=8F=AF=E8=83=BD=E5=AF=BC=E8=87=B4=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index 5372ac26c8..2dac0d0ef3 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -1123,6 +1123,11 @@ namespace MaaWpfGui.ViewModels.UI var codeName = stageName![4..^2]; var characterInfo = DataHelper.GetCharacterByCodeName(codeName); var name = DataHelper.GetLocalizedCharacterName(characterInfo); + if (string.IsNullOrEmpty(name)) + { + name = stageName; + } + var item = new CopilotItemViewModel(name, cachePath, false, copilotId) { Index = CopilotItemViewModels.Count, }; CopilotItemViewModels.Add(item); } @@ -1433,7 +1438,7 @@ namespace MaaWpfGui.ViewModels.UI return false; } - if (copilotItemViewModels.Any(i => string.IsNullOrEmpty(i.Name.Trim()))) + if (copilotItemViewModels.Any(i => string.IsNullOrEmpty(i.Name?.Trim()))) { AddLog(LocalizationHelper.GetString("CopilotTasksWithEmptyName"), UiLogColor.Error, showTime: false); return false;