diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 11221d77f0..af435daa75 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -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 ); diff --git a/eeschema/schematic.cpp b/eeschema/schematic.cpp index a9e4e39fe3..05c5eb2f7c 100644 --- a/eeschema/schematic.cpp +++ b/eeschema/schematic.cpp @@ -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(); }