diff --git a/pcbnew/convert_shape_list_to_polygon.cpp b/pcbnew/convert_shape_list_to_polygon.cpp index eadc443be3..80bc982b46 100644 --- a/pcbnew/convert_shape_list_to_polygon.cpp +++ b/pcbnew/convert_shape_list_to_polygon.cpp @@ -513,10 +513,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 ] ); @@ -563,9 +563,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; @@ -577,9 +575,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 7936c46d6a..3c1108ed8f 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 bb8f765371..a530e1b941 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 );