From eb877a2fb41ea2be47339c8f8b16a75cb8bd6031 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 12 Jul 2025 16:49:17 +0100 Subject: [PATCH] Don't presume a selection. --- common/dialogs/panel_color_settings.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/dialogs/panel_color_settings.cpp b/common/dialogs/panel_color_settings.cpp index 1c6519c2f7..8699401dc8 100644 --- a/common/dialogs/panel_color_settings.cpp +++ b/common/dialogs/panel_color_settings.cpp @@ -92,14 +92,18 @@ bool PANEL_COLOR_SETTINGS::Show( bool show ) if( show ) { // In case changes have been made to the current theme in another panel: - int idx = m_cbTheme->GetSelection(); - COLOR_SETTINGS* settings = static_cast( m_cbTheme->GetClientData( idx ) ); + int themeSel = m_cbTheme->GetSelection(); - if( settings ) - *m_currentSettings = *settings; + if( themeSel >= 0 ) + { + COLOR_SETTINGS* settings = static_cast( m_cbTheme->GetClientData( themeSel ) ); - onNewThemeSelected(); - updateSwatches(); + if( settings ) + *m_currentSettings = *settings; + + onNewThemeSelected(); + updateSwatches(); + } } return PANEL_COLOR_SETTINGS_BASE::Show( show );