From 102f5f479c6cb2c13a19fa08126fce1201a3bfd2 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 15 Jan 2020 19:40:20 +0000 Subject: [PATCH] Handle uninitialized nets gracefully. --- pcbnew/class_board.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index b11937b451..b75a2af53a 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1150,7 +1150,12 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount ) padCountListByNet.assign( max_netcode + 1, 0 ); for( D_PAD* pad : pads ) - padCountListByNet[pad->GetNetCode()]++; + { + int netCode = pad->GetNetCode(); + + if( netCode >= 0 ) + padCountListByNet[ netCode ]++; + } sort( netBuffer.begin(), netBuffer.end(), sortNetsByNodes ); }