diff --git a/pcbnew/convert_shape_list_to_polygon.cpp b/pcbnew/convert_shape_list_to_polygon.cpp index 8c0d482f0e..3ac28ca2fc 100644 --- a/pcbnew/convert_shape_list_to_polygon.cpp +++ b/pcbnew/convert_shape_list_to_polygon.cpp @@ -524,10 +524,10 @@ bool ConvertOutlineToPolygon( std::vector& aShapeList, SHAPE_POLY_SE { (*aErrorHandler)( _( "(multiple board outlines not supported)" ), a, b, contours[ contourIndex ].GetPoint( 0 ) ); + + return false; } } - - return false; } aPolygons.AddOutline( contours[ contourIndex ] ); @@ -574,9 +574,7 @@ bool ConvertOutlineToPolygon( std::vector& aShapeList, SHAPE_POLY_SE { BOARD_ITEM* a = fetchOwner( *seg1 ); BOARD_ITEM* b = fetchOwner( *seg2 ); - - if( a && b ) - (*aErrorHandler)( _( "(self-intersecting)" ), a, b, ( *seg1 ).A ); + (*aErrorHandler)( _( "(self-intersecting)" ), a, b, ( *seg1 ).A ); } selfIntersecting = true; @@ -588,9 +586,7 @@ bool ConvertOutlineToPolygon( std::vector& aShapeList, SHAPE_POLY_SE { BOARD_ITEM* a = fetchOwner( *seg1 ); BOARD_ITEM* b = fetchOwner( *seg2 ); - - if( a && b ) - (*aErrorHandler)( _( "(self-intersecting)" ), a, b, *pt ); + (*aErrorHandler)( _( "(self-intersecting)" ), a, b, *pt ); } selfIntersecting = true; diff --git a/pcbnew/dialogs/dialog_footprint_checker.cpp b/pcbnew/dialogs/dialog_footprint_checker.cpp index 293e7e79f4..ecdd86bb82 100644 --- a/pcbnew/dialogs/dialog_footprint_checker.cpp +++ b/pcbnew/dialogs/dialog_footprint_checker.cpp @@ -136,6 +136,9 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks() OUTLINE_ERROR_HANDLER outlineErrorHandler = [&]( const wxString& aMsg, BOARD_ITEM* aItemA, BOARD_ITEM* aItemB, const VECTOR2I& aPt ) { + if( !aItemA ) // If we only have a single item, make sure it's A + std::swap( aItemA, aItemB ); + errorHandler( aItemA, aItemB, nullptr, DRCE_MALFORMED_COURTYARD, aMsg, aPt ); }; diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index 1fe25231f4..4b64b894f2 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -85,6 +85,9 @@ void DRC_TEST_PROVIDER_MISC::testOutline() OUTLINE_ERROR_HANDLER errorHandler = [&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const VECTOR2I& pt ) { + if( !itemA ) // If we only have a single item, make sure it's A + std::swap( itemA, itemB ); + std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE ); drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );