diff --git a/pcbnew/dialogs/dialog_print_pcbnew.cpp b/pcbnew/dialogs/dialog_print_pcbnew.cpp index cce9842ea5..7e0e980dfa 100644 --- a/pcbnew/dialogs/dialog_print_pcbnew.cpp +++ b/pcbnew/dialogs/dialog_print_pcbnew.cpp @@ -460,7 +460,10 @@ void DIALOG_PRINT_PCBNEW::saveSettings() cfg->m_Printing.use_theme = m_checkUseTheme->GetValue(); int sel = m_colorTheme->GetSelection(); - COLOR_SETTINGS* theme = static_cast( m_colorTheme->GetClientData( sel ) ); + COLOR_SETTINGS* theme = nullptr; + + if( sel >= 0 && sel < (int) m_colorTheme->GetCount() ) + theme = static_cast( m_colorTheme->GetClientData( sel ) ); if( theme && m_checkUseTheme->IsChecked() ) {