From 6c4a4ed11b71abed417d8f1b9be6dca6ba69e051 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 28 Oct 2019 20:33:14 +0200 Subject: [PATCH] Fixed app crashes when PC is locked --- Crypto Notepad/MainForm.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index 99ca30a..ee524f9 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -36,9 +36,16 @@ protected override void WndProc(ref Message m) { const int WM_SYSCOMMAND = 0x112; const int SC_MINIMIZE = 0xF020; - if (m.Msg == WM_SYSCOMMAND & m.WParam.ToInt32() == SC_MINIMIZE & settings.autoLock & !string.IsNullOrEmpty(PublicVar.encryptionKey.Get())) + try { - richTextBox.Visible = false; + if (m.Msg == WM_SYSCOMMAND & m.WParam.ToInt32() == SC_MINIMIZE & settings.autoLock & !string.IsNullOrEmpty(PublicVar.encryptionKey.Get())) + { + richTextBox.Visible = false; + } + } + catch (OverflowException) + { + } base.WndProc(ref m); }