diff --git a/pcbnew/tools/item_modification_routine.cpp b/pcbnew/tools/item_modification_routine.cpp index de4fe7c701..67aff34174 100644 --- a/pcbnew/tools/item_modification_routine.cpp +++ b/pcbnew/tools/item_modification_routine.cpp @@ -528,6 +528,10 @@ void POLYGON_BOOLEAN_ROUTINE::Finalize() // new PCB_SHAPEs for each outline for( int i = 0; i < m_workingPolygons.OutlineCount(); ++i ) { + // If we handled any polygons to get any outline, + // there must be a layer set by now. + wxASSERT( m_layer >= 0 ); + std::unique_ptr new_poly_shape = std::make_unique( GetBoard(), SHAPE_T::POLY ); diff --git a/pcbnew/tools/item_modification_routine.h b/pcbnew/tools/item_modification_routine.h index cd96ab64d1..879b0a1608 100644 --- a/pcbnew/tools/item_modification_routine.h +++ b/pcbnew/tools/item_modification_routine.h @@ -358,8 +358,8 @@ private: SHAPE_POLY_SET m_workingPolygons; bool m_firstPolygon = true; - int m_width; - PCB_LAYER_ID m_layer; + int m_width = 0; + PCB_LAYER_ID m_layer = PCB_LAYER_ID::UNDEFINED_LAYER; }; class POLYGON_MERGE_ROUTINE : public POLYGON_BOOLEAN_ROUTINE