From c8f71ad499651fcff59634b1cfa7f421cc970a8f Mon Sep 17 00:00:00 2001 From: "SONGE9B3\\song_pd_win11" Date: Mon, 9 Jan 2023 15:22:45 +0800 Subject: [PATCH] fix: array indexing problem --- STranslate/View/MainWindow.xaml.cs | 1 + STranslate/ViewModel/MainVM.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/STranslate/View/MainWindow.xaml.cs b/STranslate/View/MainWindow.xaml.cs index a48f4ba..82b02b0 100644 --- a/STranslate/View/MainWindow.xaml.cs +++ b/STranslate/View/MainWindow.xaml.cs @@ -73,6 +73,7 @@ namespace STranslate.View /// private void Window_Deactivated(object sender, EventArgs e) { + if (vm == null) return; if (!vm.IsTopmost) { vm.Speech.SpeakAsyncCancelAll(); diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index 4bfb3a5..35b71e5 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -22,7 +22,7 @@ namespace STranslate.ViewModel if (!ReadConfig()) { - Task.Delay(3000); + IsVisibility = false; Environment.Exit(-1); }