diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index 159ed9d34d..d6ef39322a 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -631,7 +631,7 @@ void SHAPE_LINE_CHAIN::Append( const SHAPE_ARC& aArc ) void SHAPE_LINE_CHAIN::Insert( size_t aVertex, const VECTOR2I& aP ) { - if( m_shapes[aVertex] != SHAPE_IS_PT ) + if( aVertex < m_points.size() && m_shapes[aVertex] != SHAPE_IS_PT ) convertArc( aVertex ); m_points.insert( m_points.begin() + aVertex, aP );