From 0ccd706faf7a5d975a8dd30a913b59b2034f2177 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 7 Jul 2025 12:05:32 +0100 Subject: [PATCH] Bounds checking. KICAD-A6F. --- pcbnew/dialogs/dialog_print_pcbnew.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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() ) {