From 8de4f762e12b669b8bdbd769eb0eb5323a95b239 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 27 Feb 2022 09:59:42 +0100 Subject: [PATCH] svg importer: fix a crash when importing some files with no graphic item --- pcbnew/import_gfx/graphics_importer_buffer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pcbnew/import_gfx/graphics_importer_buffer.cpp b/pcbnew/import_gfx/graphics_importer_buffer.cpp index 13b880b333..9f21c2e052 100644 --- a/pcbnew/import_gfx/graphics_importer_buffer.cpp +++ b/pcbnew/import_gfx/graphics_importer_buffer.cpp @@ -207,7 +207,11 @@ void GRAPHICS_IMPORTER_BUFFER::PostprocessNestedPolygons() } } - convertPolygon( newShapes, polypaths, m_shapeFillRules[curShapeIdx], lastWidth ); + POLY_FILL_RULE last_rule = curShapeIdx>= 0 && m_shapeFillRules.size() + ? m_shapeFillRules[curShapeIdx] + : POLY_FILL_RULE::PF_EVEN_ODD; + + convertPolygon( newShapes, polypaths, last_rule, lastWidth ); m_shapes.swap( newShapes ); }