Skip to content

Commit

Permalink
fix: 修复在课表编辑界面选中含有正在删除科目的课程时,使 SubjectId 为 null 导致主循环异常的问题 ClassIslan…
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloWRC committed Sep 30, 2024
1 parent 1b9d396 commit f6115cd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ClassIsland.Shared/Models/Profile/ClassInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public string SubjectId
set
{
if (value == _subjectId) return;
_subjectId = value;
_subjectId = value ?? "";
OnPropertyChanged();
}
}
Expand Down
2 changes: 1 addition & 1 deletion ClassIsland/Services/LessonsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private void ProcessLessons()
{
NextClassTimeLayoutItem = nextClassTimeLayoutItem;
var i0 = GetSubjectIndex(currentLayout.IndexOf(nextClassTimeLayoutItem));
var index = CurrentClassPlan.Classes[i0].SubjectId;
var index = CurrentClassPlan.Classes[i0].SubjectId ?? "";
Profile.Subjects.TryGetValue(index, out var subject);
NextClassSubject = subject ?? Subject.Empty;
}
Expand Down
2 changes: 1 addition & 1 deletion ClassIsland/Views/ProfileSettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@
<ListBox
Grid.Row="0"
SelectedValuePath="Key"
SelectedValue="{Binding ViewModel.SelectedClassInfo.SubjectId, RelativeSource={RelativeSource FindAncestor, AncestorType=local:ProfileSettingsWindow}, FallbackValue=''}"
SelectedValue="{Binding ViewModel.SelectedClassInfo.SubjectId, RelativeSource={RelativeSource FindAncestor, AncestorType=local:ProfileSettingsWindow}, FallbackValue='', Converter={StaticResource PreventNullConverter}}"
ItemsSource="{Binding ProfileService.Profile.Subjects, RelativeSource={RelativeSource FindAncestor, AncestorType=local:ProfileSettingsWindow}}"
Style="{StaticResource MaterialDesignNavigationPrimaryListBox}">
<ListBox.ItemContainerStyle>
Expand Down

0 comments on commit f6115cd

Please sign in to comment.