DIALOG_BOARD_REANNOTATE: ensure indexes are not out of bound.

This commit is contained in:
jean-pierre charras 2023-03-12 16:58:56 +01:00
parent cc6b01cf88
commit 7b4dd2f7f5
1 changed files with 10 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Brian Piccioni brian@documenteddesigns.com
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Brian Piccioni <brian@documenteddesigns.com>
*
* This program is free software; you can redistribute it and/or
@ -128,6 +128,9 @@ DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
for( wxRadioButton* button : m_sortButtons )
button->SetValue( false );
if( m_sortCode < 0 || m_sortCode >= (int) m_sortButtons.size() )
m_sortCode = 0;
m_sortButtons[m_sortCode]->SetValue( true );
m_selection = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
@ -138,6 +141,9 @@ DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
for( wxRadioButton* button : m_scopeRadioButtons )
button->SetValue( false );
if( m_annotationScope < 0 || m_annotationScope >= (int) m_scopeRadioButtons.size() )
m_annotationScope = 0;
m_scopeRadioButtons[m_annotationScope]->SetValue( true );
reannotate_down_right_bitmap->SetBitmap( KiBitmap( BITMAPS::reannotate_right_down ) );
@ -419,6 +425,9 @@ void DIALOG_BOARD_REANNOTATE::GetParameters()
m_annotationScope++;
}
if( m_annotationScope >= (int) m_scopeRadioButtons.size() )
m_annotationScope = 0;
m_MessageWindow->SetLazyUpdate( true );
}