diff --git a/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs b/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs index a1efe9ad7..bd9fa9849 100644 --- a/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs +++ b/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs @@ -874,31 +874,27 @@ private async Task DecompiledLostFocusBody(object sender, RoutedEventArgs e) } code.Replace(compileContext.ResultAssembly); - - if (!mainWindow.Data.IsVersionAtLeast(2, 3)) + try { - try + string path = Path.Combine(TempPath, code.Name.Content + ".gml"); + if (SettingsWindow.ProfileModeEnabled) { - string path = Path.Combine(TempPath, code.Name.Content + ".gml"); - if (SettingsWindow.ProfileModeEnabled) - { - // Write text, only if in the profile mode. - File.WriteAllText(path, DecompiledEditor.Text); - } - else - { - // Destroy file with comments if it's been edited outside the profile mode. - // We're dealing with the decompiled code only, it has to happen. - // Otherwise it will cause a desync, which is more important to prevent. - if (File.Exists(path)) - File.Delete(path); - } + // Write text, only if in the profile mode. + File.WriteAllText(path, DecompiledEditor.Text); } - catch (Exception exc) + else { - mainWindow.ShowError("Error during writing of GML code to profile:\n" + exc); + // Destroy file with comments if it's been edited outside the profile mode. + // We're dealing with the decompiled code only, it has to happen. + // Otherwise it will cause a desync, which is more important to prevent. + if (File.Exists(path)) + File.Delete(path); } } + catch (Exception exc) + { + mainWindow.ShowError("Error during writing of GML code to profile:\n" + exc); + } // Invalidate gettext if necessary if (code.Name.Content == "gml_Script_textdata_en")