diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 92c5c39d89..34e1e43b31 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -1040,12 +1040,13 @@ int LINE::Rank() const { int min_rank = INT_MAX; - if( IsLinked() ) { - for( auto s : m_links ) - { - min_rank = std::min( min_rank, s->Rank() ); - } - } else { + if( IsLinked() ) + { + for( const LINKED_ITEM* item : m_links ) + min_rank = std::min( min_rank, item->Rank() ); + } + else + { min_rank = m_rank; }