diff --git a/common/dialogs/panel_color_settings.cpp b/common/dialogs/panel_color_settings.cpp index aa410bc270..2112dd84fd 100644 --- a/common/dialogs/panel_color_settings.cpp +++ b/common/dialogs/panel_color_settings.cpp @@ -198,8 +198,17 @@ void PANEL_COLOR_SETTINGS::createSwatch( int aLayer, const wxString& aName ) { wxStaticText* label = new wxStaticText( m_colorsListWindow, wxID_ANY, aName ); + // The previously selected theme can be deleted and cannot be selected. + // so select the default theme (first theme of the list) + if( m_cbTheme->GetSelection() < 0 ) + { + m_cbTheme->SetSelection( 0 ); + onNewThemeSelected(); + } + void* clientData = m_cbTheme->GetClientData( m_cbTheme->GetSelection() ); COLOR_SETTINGS* selected = static_cast( clientData ); + int id = FIRST_BUTTON_ID + aLayer; COLOR4D defaultColor = selected->GetDefaultColor( aLayer ); COLOR4D color = m_currentSettings->GetColor( aLayer );