diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 2cb1824225..977467e1ea 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -613,8 +613,12 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa if( dynamic_cast( other) ) testClearance = false; - // Pads of the same (defined) net get a waiver on clearance and hole tests - if( otherPad && pad->GetNetCode() && otherPad->GetNetCode() == pad->GetNetCode() ) + int padNet = pad->GetNetCode(); + int otherPadNet = otherPad ? otherPad->GetNetCode() : 0; + int otherViaNet = otherVia ? otherVia->GetNetCode() : 0; + + // Pads and vias of the same (defined) net get a waiver on clearance and hole tests + if( ( otherPadNet && otherPadNet == padNet ) || ( otherViaNet && otherViaNet == padNet ) ) { testClearance = false; testHoles = false;