Skip to content

Commit

Permalink
Merge pull request #1284 from oxygen-dioxide/textbox-undo
Browse files Browse the repository at this point in the history
Fix openutau crashing after pressing Ctrl+Z in lyric box twice and enter
  • Loading branch information
stakira authored Nov 11, 2024
2 parents 5c931c7 + d5c673c commit d73ea6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions OpenUtau/ViewModels/LyricBoxViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SuggestionItem {
[Reactive] public UVoicePart? Part { get; set; }
[Reactive] public LyricBoxNoteOrPhoneme? NoteOrPhoneme { get; set; }
[Reactive] public bool IsVisible { get; set; }
[Reactive] public string Text { get; set; }
[Reactive] public string? Text { get; set; }
[Reactive] public SuggestionItem? SelectedSuggestion { get; set; }
[Reactive] public ObservableCollectionExtended<SuggestionItem> Suggestions { get; set; }

Expand Down Expand Up @@ -55,7 +55,7 @@ private void UpdateSuggestion() {
return;
}
var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
Task.Run(() => singer.GetSuggestions(Text).Select(oto => new SuggestionItem() {
Task.Run(() => singer.GetSuggestions(Text ?? "").Select(oto => new SuggestionItem() {
Alias = oto.Alias,
Source = string.IsNullOrEmpty(oto.Set) ? singer.Id : $"{singer.Id} / {oto.Set}",
}).Take(32).ToList()).ContinueWith(task => {
Expand All @@ -77,7 +77,7 @@ private void UpdateSuggestion() {
}

public void Commit() {
if (Part == null || NoteOrPhoneme == null) {
if (Part == null || NoteOrPhoneme == null || Text == null) {
return;
}
if (!IsAliasBox) {
Expand Down

0 comments on commit d73ea6b

Please sign in to comment.