Skip to content

Commit fac2095

Browse files
committed
fix: 防止打开脚本失败崩溃
1 parent 552b03c commit fac2095

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

llcom/View/MainWindow.xaml.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,16 @@ private void loadLuaFile(string fileName)
858858
}
859859

860860
//文件内容显示出来
861-
textEditor.Text = File.ReadAllText(Tools.Global.ProfilePath + $"user_script_run/{Tools.Global.setting.runScript}.lua");
861+
try
862+
{
863+
textEditor.Text = File.ReadAllText(Tools.Global.ProfilePath + $"user_script_run/{Tools.Global.setting.runScript}.lua");
864+
}
865+
catch
866+
{
867+
MessageBox.Show("File load failed.\r\n" +
868+
"Do not open this file in other application!");
869+
return;
870+
}
862871

863872
//记录最后时间
864873
lastLuaFileTime = File.GetLastWriteTime(Tools.Global.ProfilePath + $"user_script_run/{Tools.Global.setting.runScript}.lua");

0 commit comments

Comments
 (0)