Fix testcase crash when progressReporter was null.

(And it helps if the DRC tester you're trying to test is actually
in the make file.)
This commit is contained in:
Jeff Young 2020-09-15 21:49:51 +01:00
parent 6a7266d589
commit b4229d9a3e
4 changed files with 10 additions and 5 deletions

View File

@ -238,6 +238,7 @@ set( PCBNEW_DRC_SRCS
drc/drc_test_provider_disallow.cpp
drc/drc_test_provider_connectivity.cpp
drc/drc_test_provider_copper_clearance.cpp
drc/drc_test_provider_courtyard_clearance.cpp
drc/drc_test_provider_edge_clearance.cpp
drc/drc_test_provider_hole_clearance.cpp
drc/drc_test_provider_hole_size.cpp

View File

@ -405,13 +405,15 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aTestTracksAgainstZones,
m_reportAllTrackErrors = aReportAllTrackErrors;
m_testFootprints = aTestFootprints;
int phases = 0;
for( DRC_TEST_PROVIDER* provider : m_testProviders )
phases += provider->GetNumPhases();
if( m_progressReporter )
{
int phases = 0;
for( DRC_TEST_PROVIDER* provider : m_testProviders )
phases += provider->GetNumPhases();
m_progressReporter->AddPhases( phases );
}
for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii )
{

View File

@ -302,6 +302,7 @@ void DoCourtyardInvalidTest( const COURTYARD_INVALID_CASE& aCase,
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
{
if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS
|| aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD
|| aItem->GetErrorCode() == DRCE_MISSING_COURTYARD )
{
markers.push_back( std::make_unique<MARKER_PCB>( aItem, aPos ) );

View File

@ -471,6 +471,7 @@ static void DoCourtyardOverlapTest( const COURTYARD_OVERLAP_TEST_CASE& aCase,
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
{
if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS
|| aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD
|| aItem->GetErrorCode() == DRCE_MISSING_COURTYARD )
{
markers.push_back( std::make_unique<MARKER_PCB>( aItem, aPos ) );