From fb486ff6b48693eb6720ea48fba188fe4a1d669c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 28 Nov 2024 17:50:11 +0000 Subject: [PATCH] Handle degenerate polygons in RTrees. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18600 (cherry picked from commit d5ecb4ab555fd091b7c1909c2d18889c5036a6cf) --- pcbnew/drc/drc_rtree.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pcbnew/drc/drc_rtree.h b/pcbnew/drc/drc_rtree.h index cf4a3b1b17..d12b5b3a59 100644 --- a/pcbnew/drc/drc_rtree.h +++ b/pcbnew/drc/drc_rtree.h @@ -353,7 +353,13 @@ public: [&]( ITEM_WITH_SHAPE* aItem ) -> bool { const SHAPE* shape = aItem->shape; - wxASSERT( dynamic_cast( shape ) ); + + // There are certain degenerate cases that result in empty zone fills, which + // will be represented in the rtree with only a root (and no triangles). + // https://gitlab.com/kicad/code/kicad/-/issues/18600 + if( shape->Type() != SH_POLY_SET_TRIANGLE ) + return true; + auto tri = static_cast( shape ); const SHAPE_LINE_CHAIN& outline = poly->Outline( 0 );