From d34e9e8946b9c868f191bfc0d47e59903f036c9d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 13 Aug 2021 20:16:32 +0100 Subject: [PATCH] Code safety. --- pcbnew/drc/drc_test_provider_copper_clearance.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 1977fd2e7c..43081ef34f 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -345,8 +345,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track, if( holeShape ) { - constraint = m_drcEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, other, track, - track->GetLayer() ); + constraint = m_drcEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, other, track, layer ); clearance = constraint.GetValue().Min(); if( clearance > 0 && trackShape->Collide( holeShape.get(), @@ -437,7 +436,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem } if( zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer, - clearance - m_drcEpsilon, &actual, &pos ) ) + std::max( 0, clearance - m_drcEpsilon ), + &actual, &pos ) ) { std::shared_ptr drce = DRC_ITEM::Create( DRCE_CLEARANCE ); @@ -481,7 +481,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem clearance = constraint.GetValue().Min(); if( zoneTree->QueryColliding( itemBBox, holeShape.get(), aLayer, - clearance - m_drcEpsilon, &actual, &pos ) ) + std::max( 0, clearance - m_drcEpsilon ), + &actual, &pos ) ) { std::shared_ptr drce = DRC_ITEM::Create( DRCE_HOLE_CLEARANCE );