diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index d97afa9861..856b03db7d 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -2017,34 +2017,36 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) // Lambda to accumulate track length if item is a track or arc, otherwise mark invalid std::function<void( EDA_ITEM* )> accumulateTrackLength; - accumulateTrackLength = [&]( EDA_ITEM* aItem ) - { - if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( aItem ) ) - { - selectedLength += track->GetLength(); - } - else if( PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem ) ) - { - const SHAPE_T shapeType = shape->GetShape(); - if( shapeType == SHAPE_T::SEGMENT || shapeType == SHAPE_T::ARC - || shapeType == SHAPE_T::BEZIER ) + accumulateTrackLength = + [&]( EDA_ITEM* aItem ) { - selectedLength += shape->GetLength(); - } - else - { - lengthValid = false; - } - } - else if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( aItem ) ) - { - group->RunOnChildren( accumulateTrackLength ); - } - else - { - lengthValid = false; - } - }; + if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( aItem ) ) + { + selectedLength += track->GetLength(); + } + else if( PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem ) ) + { + const SHAPE_T shapeType = shape->GetShape(); + + if( shapeType == SHAPE_T::SEGMENT || shapeType == SHAPE_T::ARC + || shapeType == SHAPE_T::BEZIER ) + { + selectedLength += shape->GetLength(); + } + else + { + lengthValid = false; + } + } + else if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( aItem ) ) + { + group->RunOnChildren( accumulateTrackLength ); + } + else + { + lengthValid = false; + } + }; for( EDA_ITEM* item : selection ) accumulateTrackLength( item );