Move checking for null parent higher.
(Otherwise we set the failure flag without telling the user why. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15415
This commit is contained in:
parent
726f09f9ad
commit
6a6e839cc4
|
@ -513,10 +513,10 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
|
||||||
{
|
{
|
||||||
(*aErrorHandler)( _( "(multiple board outlines not supported)" ), a, b,
|
(*aErrorHandler)( _( "(multiple board outlines not supported)" ), a, b,
|
||||||
contours[ contourIndex ].GetPoint( 0 ) );
|
contours[ contourIndex ].GetPoint( 0 ) );
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aPolygons.AddOutline( contours[ contourIndex ] );
|
aPolygons.AddOutline( contours[ contourIndex ] );
|
||||||
|
@ -563,9 +563,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
|
||||||
{
|
{
|
||||||
BOARD_ITEM* a = fetchOwner( *seg1 );
|
BOARD_ITEM* a = fetchOwner( *seg1 );
|
||||||
BOARD_ITEM* b = fetchOwner( *seg2 );
|
BOARD_ITEM* b = fetchOwner( *seg2 );
|
||||||
|
(*aErrorHandler)( _( "(self-intersecting)" ), a, b, ( *seg1 ).A );
|
||||||
if( a && b )
|
|
||||||
(*aErrorHandler)( _( "(self-intersecting)" ), a, b, ( *seg1 ).A );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selfIntersecting = true;
|
selfIntersecting = true;
|
||||||
|
@ -577,9 +575,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
|
||||||
{
|
{
|
||||||
BOARD_ITEM* a = fetchOwner( *seg1 );
|
BOARD_ITEM* a = fetchOwner( *seg1 );
|
||||||
BOARD_ITEM* b = fetchOwner( *seg2 );
|
BOARD_ITEM* b = fetchOwner( *seg2 );
|
||||||
|
(*aErrorHandler)( _( "(self-intersecting)" ), a, b, *pt );
|
||||||
if( a && b )
|
|
||||||
(*aErrorHandler)( _( "(self-intersecting)" ), a, b, *pt );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selfIntersecting = true;
|
selfIntersecting = true;
|
||||||
|
|
|
@ -136,6 +136,9 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks()
|
||||||
OUTLINE_ERROR_HANDLER outlineErrorHandler =
|
OUTLINE_ERROR_HANDLER outlineErrorHandler =
|
||||||
[&]( const wxString& aMsg, BOARD_ITEM* aItemA, BOARD_ITEM* aItemB, const VECTOR2I& aPt )
|
[&]( 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 );
|
errorHandler( aItemA, aItemB, nullptr, DRCE_MALFORMED_COURTYARD, aMsg, aPt );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,9 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
|
||||||
OUTLINE_ERROR_HANDLER errorHandler =
|
OUTLINE_ERROR_HANDLER errorHandler =
|
||||||
[&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const VECTOR2I& pt )
|
[&]( 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<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
|
||||||
|
|
||||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||||
|
|
Loading…
Reference in New Issue