Pcbnew : allows overwriting viewport with same name in appearance manager.

Fixes #12765
https://gitlab.com/kicad/code/kicad/issues/12765
This commit is contained in:
jean-pierre charras 2022-11-07 09:11:49 +01:00
parent 311741a9a3
commit dc6fcc262c
1 changed files with 2 additions and 1 deletions

View File

@ -2746,7 +2746,7 @@ void APPEARANCE_CONTROLS::updateViewportSelection( const wxString& aName )
{
int idx = m_cbViewports->FindString( aName );
if( idx >= 0 && m_cbViewports->GetSelection() != idx )
if( idx >= 0 && idx < (int)m_cbViewports->GetCount() - 3 /* separator */ )
{
m_cbViewports->SetSelection( idx );
m_lastSelectedViewport = static_cast<VIEWPORT*>( m_cbViewports->GetClientData( idx ) );
@ -2806,6 +2806,7 @@ void APPEARANCE_CONTROLS::onViewportChanged( wxCommandEvent& aEvent )
}
else
{
m_viewports[name].rect = m_frame->GetCanvas()->GetView()->GetViewport();
index = m_cbViewports->FindString( name );
m_viewportMRU.Remove( name );
}