diff --git a/pcbnew/dialogs/dialog_net_inspector.cpp b/pcbnew/dialogs/dialog_net_inspector.cpp index 950e88c949..f99b97ae58 100644 --- a/pcbnew/dialogs/dialog_net_inspector.cpp +++ b/pcbnew/dialogs/dialog_net_inspector.cpp @@ -1373,23 +1373,7 @@ unsigned int DIALOG_NET_INSPECTOR::calculateViaLength( const TRACK* aTrack ) con if( bds.m_HasStackup ) { const BOARD_STACKUP& stackup = bds.GetStackupDescriptor(); - - std::pair layer_dist[2] = { std::make_pair( via.TopLayer(), 0 ), - std::make_pair( via.BottomLayer(), 0 ) }; - - for( const BOARD_STACKUP_ITEM* i : stackup.GetList() ) - { - for( std::pair& j : layer_dist ) - { - if( j.first != UNDEFINED_LAYER ) - j.second += i->GetThickness(); - - if( j.first == i->GetBrdLayerId() ) - j.first = UNDEFINED_LAYER; - } - } - - return std::abs( layer_dist[0].second - layer_dist[1].second ); + return stackup.GetLayerDistance( via.TopLayer(), via.BottomLayer() ); } else {