diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 96ebf1e661..64e463693f 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -199,9 +199,9 @@ bool SCH_EDIT_TOOL::Init() && aSel.AreAllItemsIdentical() ) ) return false; - EDA_ITEM* item = static_cast( aSel.Front() ); + EDA_ITEM* firstItem = static_cast( aSel.Front() ); - switch( item->Type() ) + switch( firstItem->Type() ) { case SCH_COMPONENT_T: case SCH_SHEET_T: @@ -215,12 +215,15 @@ bool SCH_EDIT_TOOL::Init() return aSel.GetSize() == 1; case SCH_LINE_T: - return std::all_of( aSel.GetItems().begin(), aSel.GetItems().end(), - [&]( EDA_ITEM* selItem ) - { - SCH_LINE* line = dynamic_cast( selItem ); - return line && line->IsGraphicLine(); - } ); + for( EDA_ITEM* item : aSel.GetItems() ) + { + SCH_LINE* line = dynamic_cast( item ); + + if( !line || !line->IsGraphicLine() ) + return false; + } + + return true; default: return false;