Avoid double-processing SCH_ITEMs

Elements such as zero-length lines might get into the connection map,
causing the system to process them twice.  This can cause allocation
errors when both are performed at the same time

Fixes https://gitlab.com/kicad/code/kicad/issues/12278
This commit is contained in:
Seth Hillbrand 2022-10-01 12:24:54 -07:00
parent fdf9fcc24d
commit 9adae0e8ba
1 changed files with 4 additions and 1 deletions

View File

@ -647,7 +647,10 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
for( const auto& it : connection_map )
{
const std::vector<SCH_ITEM*>& connection_vec = it.second;
std::vector<SCH_ITEM*> connection_vec = it.second;
std::sort( connection_vec.begin(), connection_vec.end() );
connection_vec.erase( std::unique( connection_vec.begin(), connection_vec.end() ),
connection_vec.end() );
// Pre-scan to see if we have a bus at this location
SCH_LINE* busLine = aSheet.LastScreen()->GetBus( it.first );