From f6314e64016b4117e13babd7e38ffc10f4a0c27a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 13 Nov 2023 18:36:00 +0100 Subject: [PATCH] FOOTPRINT::cmp_drawings(): fix a incorrect sort criteria for polygons: for polygons, GetStart() and GetEnd() have no meaning and cannotbe used for sorting. --- pcbnew/footprint.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index d7268cc96d..c6b2c73b78 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -3015,8 +3015,13 @@ bool FOOTPRINT::cmp_drawings::operator()( const BOARD_ITEM* itemA, const BOARD_I TEST( dwgA->GetShape(), dwgB->GetShape() ); - TEST_PT( dwgA->GetStart(), dwgB->GetStart() ); - TEST_PT( dwgA->GetEnd(), dwgB->GetEnd() ); + // GetStart() and GetEnd() have no meaning with polygons. + // We cannot use them for sorting polygons + if( dwgA->GetShape() != SHAPE_T::POLY ) + { + TEST_PT( dwgA->GetStart(), dwgB->GetStart() ); + TEST_PT( dwgA->GetEnd(), dwgB->GetEnd() ); + } if( dwgA->GetShape() == SHAPE_T::ARC ) {