From 7359a19142caf12d8f43f1731deb35b14e765f83 Mon Sep 17 00:00:00 2001 From: Michael Seibt Date: Sat, 10 Apr 2021 23:53:13 +0200 Subject: [PATCH] Suppress "Theme not found" if setting is empty (cherry picked from commit 022d6df9681274c9b1eac78096ba78e6063cc6ba) --- .../SettingsDialog/Pages/ColorsSettingsPage.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GitUI/CommandsDialogs/SettingsDialog/Pages/ColorsSettingsPage.cs b/GitUI/CommandsDialogs/SettingsDialog/Pages/ColorsSettingsPage.cs index 1400abcb4b9..17c17daed4f 100644 --- a/GitUI/CommandsDialogs/SettingsDialog/Pages/ColorsSettingsPage.cs +++ b/GitUI/CommandsDialogs/SettingsDialog/Pages/ColorsSettingsPage.cs @@ -38,7 +38,7 @@ private ThemeId SelectedThemeId } set { - var formattedThemeId = new FormattedThemeId(value); + FormattedThemeId formattedThemeId = new(value); int index = _NO_TRANSLATE_cbSelectTheme.Items.IndexOf(formattedThemeId); if (index < 0) { @@ -47,7 +47,13 @@ private ThemeId SelectedThemeId // - user creates custom theme and selects it in this settings page // - user saves app settings // - user deletes the file with custom theme - MessageBoxes.ShowError(this, "Theme not found: " + formattedThemeId); + // - on first install; suppress MessageBox + string theme = formattedThemeId.ToString(); + if (!string.IsNullOrWhiteSpace(theme)) + { + MessageBoxes.ShowError(FindForm(), $"Theme not found: {theme}"); + } + index = 0; }