From 5e9ec826423638329e42310d7225c93a20424a3a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 4 Sep 2020 21:37:23 +0100 Subject: [PATCH] Correctly resolve textVar refs in worksheet items in ERC. Also fixes a null-ptr bug in DRC. Fixes https://gitlab.com/kicad/code/kicad/issues/5506 --- eeschema/erc.cpp | 6 ++++++ pcbnew/dialogs/dialog_drc.cpp | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 8defe81daa..6549967455 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -157,6 +157,12 @@ void ERC_TESTER::TestTextVars( KIGFX::WS_PROXY_VIEW_ITEM* aWorksheet ) if( aWorksheet ) { wsItems.SetMilsToIUfactor( IU_PER_MILS ); + wsItems.SetSheetNumber( 1 ); + wsItems.SetSheetCount( 1 ); + wsItems.SetFileName( "dummyFilename" ); + wsItems.SetSheetName( "dummySheet" ); + wsItems.SetSheetLayer( "dummyLayer" ); + wsItems.SetProject( &m_schematic->Prj() ); wsItems.BuildWorkSheetGraphicList( aWorksheet->GetPageInfo(), aWorksheet->GetTitleBlock() ); } diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 9faa7767f3..d13e43f982 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -250,7 +250,10 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent ) BOARD_ITEM* c = board->GetItem( rc_item->GetAuxItem2ID() ); BOARD_ITEM* d = board->GetItem( rc_item->GetAuxItem3ID() ); - LSET violationLayers = a->GetLayerSet(); + LSET violationLayers; + + if( a ) + violationLayers &= a->GetLayerSet(); if( b ) violationLayers &= b->GetLayerSet();