mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Fix crash when trying to draw a schematic polygon with no segments.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18246
This commit is contained in:
parent
0040c290ed
commit
69ee94f289
@ -1491,17 +1491,22 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer, bool aDimmed )
|
|||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
{
|
{
|
||||||
const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes( true );
|
const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes( true );
|
||||||
|
|
||||||
|
if( !polySegments.empty() )
|
||||||
|
{
|
||||||
std::deque<VECTOR2D> pts;
|
std::deque<VECTOR2D> pts;
|
||||||
|
|
||||||
for( SHAPE* polySegment : polySegments )
|
for( SHAPE* polySegment : polySegments )
|
||||||
pts.push_back( static_cast<SHAPE_SEGMENT*>( polySegment )->GetSeg().A );
|
pts.push_back( static_cast<SHAPE_SEGMENT*>( polySegment )->GetSeg().A );
|
||||||
|
|
||||||
pts.push_back( static_cast<SHAPE_SEGMENT*>( polySegments.back() )->GetSeg().B );
|
pts.push_back(
|
||||||
|
static_cast<SHAPE_SEGMENT*>( polySegments.back() )->GetSeg().B );
|
||||||
|
|
||||||
for( SHAPE* polySegment : polySegments )
|
for( SHAPE* polySegment : polySegments )
|
||||||
delete polySegment;
|
delete polySegment;
|
||||||
|
|
||||||
m_gal->DrawPolygon( pts );
|
m_gal->DrawPolygon( pts );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user