From 3c965a6c3ea8dbce3552bda8a206a09e2cf1d114 Mon Sep 17 00:00:00 2001 From: "Krom, Robertus" Date: Tue, 11 Feb 2020 12:59:49 +0100 Subject: [PATCH] BUG-2542: Fix for shutdown issue (ImgurPlugin) --- GreenshotImgurPlugin/ImgurPlugin.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/GreenshotImgurPlugin/ImgurPlugin.cs b/GreenshotImgurPlugin/ImgurPlugin.cs index 899d097cb..a6c5dba4a 100644 --- a/GreenshotImgurPlugin/ImgurPlugin.cs +++ b/GreenshotImgurPlugin/ImgurPlugin.cs @@ -129,11 +129,17 @@ namespace GreenshotImgurPlugin { } try { - _host.GreenshotForm.BeginInvoke((MethodInvoker)delegate { - if (_config.ImgurUploadHistory != null && _config.ImgurUploadHistory.Count > 0) { - _historyMenuItem.Enabled = true; + _host.GreenshotForm.BeginInvoke((MethodInvoker)delegate + { + var historyMenuItem = _historyMenuItem; + if (historyMenuItem == null) + { + return; + } + if (_config?.ImgurUploadHistory != null && _config.ImgurUploadHistory.Count > 0) { + historyMenuItem.Enabled = true; } else { - _historyMenuItem.Enabled = false; + historyMenuItem.Enabled = false; } }); } catch (Exception ex) {