bugfix: pcbnew crashes when you try to save a file

This commit is contained in:
Kirill Mavreshko 2014-07-14 09:41:02 +02:00 committed by Maciej Suminski
parent 7d1c1f3085
commit ae44fb62fc
1 changed files with 4 additions and 2 deletions

View File

@ -63,12 +63,14 @@ static const wxString traceFootprintLibrary( wxT( "KicadFootprintLib" ) );
///> Removes empty nets (i.e. with node count equal zero) from net classes ///> Removes empty nets (i.e. with node count equal zero) from net classes
void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass ) void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass )
{ {
for( NETCLASS::const_iterator it = aNetClass.begin(); it != aNetClass.end(); ++it ) for( NETCLASS::const_iterator it = aNetClass.begin(); it != aNetClass.end(); )
{ {
NETINFO_ITEM* netinfo = aBoard.FindNet( *it ); NETINFO_ITEM* netinfo = aBoard.FindNet( *it );
if( netinfo && netinfo->GetNodesCount() <= 0 ) // hopefully there are no nets with negative if( netinfo && netinfo->GetNodesCount() <= 0 ) // hopefully there are no nets with negative
aNetClass.Remove( it ); // node count, but you never know.. aNetClass.Remove( it++ ); // node count, but you never know..
else
++it;
} }
} }