diff --git a/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs b/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs index 4cb9dc0..d5cfe06 100644 --- a/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs +++ b/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs @@ -12,7 +12,7 @@ namespace CRSim.Views public string TicketCheck { get; set; } public bool Checked { get; set; } = false; } - + public ObservableCollection Landmarks { get; set; } = ["无", "红色", "绿色", "褐色", "蓝色", "紫色", "黄色", "橙色"]; public TrainStop GeneratedTrainStop; @@ -124,7 +124,7 @@ namespace CRSim.Views Origin = DepartureTextBox.Text, ArrivalTime = StartHour.IsEnabled ? TimeSpan.Parse($"{StartHour.Text}:{StartMinute.Text}") : null, DepartureTime = EndHour.IsEnabled ? TimeSpan.Parse($"{EndHour.Text}:{EndMinute.Text}") : null, - WaitingArea = TicketChecksList.Where(x => x.Checked).FirstOrDefault().TicketCheck.Split(" - ")[0], + WaitingArea = TicketChecksList.Where(x => x.Checked).FirstOrDefault()?.TicketCheck.Split(" - ")[0] ?? string.Empty, TicketChecks = [.. TicketChecksList.Where(x => x.Checked).Select(x => x.TicketCheck.Split(" - ")[1])], Platform = (string)PlatformComboBox.SelectedItem, Length = int.Parse(LengthTextBox.Text),