From ab5b2dd17bba1000c4e8496a8b6ec49ff9531ebc Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 3 Jul 2025 14:33:51 -0600 Subject: [PATCH] Update enabled layers when starting FP Editor. --- pcbnew/footprint_edit_frame.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index f5c1ad2dff..96cb2273ba 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -543,17 +543,20 @@ void FOOTPRINT_EDIT_FRAME::updateEnabledLayers() GetBoard()->SetCopperLayerCount( 3 ); GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) ); - // Don't drop pre-existing user layers LSET enabledLayers = GetBoard()->GetEnabledLayers(); - m_originalFootprintCopy->RunOnDescendants( - [&]( BOARD_ITEM* child ) - { - LSET childLayers = child->GetLayerSet() & LSET::UserDefinedLayersMask(); + // Don't drop pre-existing user layers + if( m_originalFootprintCopy ) + { + m_originalFootprintCopy->RunOnDescendants( + [&]( BOARD_ITEM* child ) + { + LSET childLayers = child->GetLayerSet() & LSET::UserDefinedLayersMask(); - for( PCB_LAYER_ID layer : childLayers ) - enabledLayers.set( layer ); - } ); + for( PCB_LAYER_ID layer : childLayers ) + enabledLayers.set( layer ); + } ); + } // Enable any layers that the user has gone to the trouble to name SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();