diff --git a/Crypto Notepad/Form1.cs b/Crypto Notepad/Form1.cs index e968150..53610fc 100644 --- a/Crypto Notepad/Form1.cs +++ b/Crypto Notepad/Form1.cs @@ -257,6 +257,11 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) NameWithotPath = Path.GetFileName(OpenFile.FileName); } + if (NameWithotPath == "") + { + NameWithotPath = noname; + } + if (customRTB.Text != "") { DialogResult res = new DialogResult(); @@ -278,12 +283,13 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { saveToolStripMenuItem1_Click_1(this, new EventArgs()); } - Application.Exit(); + + e.Cancel = true; } if (res == DialogResult.No) { - Environment.Exit(0); + return; } if (res == DialogResult.Cancel)