Don't blow up the sheet path when selecting an ERC item

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4685
This commit is contained in:
Jon Evans 2020-06-19 17:00:41 -04:00
parent 96a5a96037
commit 6d2f30005e
2 changed files with 6 additions and 2 deletions

View File

@ -350,11 +350,11 @@ void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent )
SCH_SHEET_PATH sheet;
SCH_ITEM* item = m_parent->Schematic().GetSheets().GetItem( itemID, &sheet );
if( item )
if( item && item->GetClass() != wxT( "DELETED_SHEET_ITEM" ) )
{
WINDOW_THAWER thawer( m_parent );
if( sheet != m_parent->GetCurrentSheet() )
if( !sheet.empty() && sheet != m_parent->GetCurrentSheet() )
{
m_parent->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );

View File

@ -55,12 +55,16 @@ void SCHEMATIC::Reset()
}
void SCHEMATIC::SetRoot( SCH_SHEET* aRootSheet )
{
wxCHECK_RET( aRootSheet, "Call to SetRoot with null SCH_SHEET!" );
m_rootSheet = aRootSheet;
m_currentSheet->clear();
m_currentSheet->push_back( m_rootSheet );
m_connectionGraph->Reset();
}