Commit 7161c5bd authored by Kirill Mavreshko's avatar Kirill Mavreshko Committed by Maciej Suminski
Browse files

bugfix: pcbnew crashes when you try to save a file

parent 3f8f6caf
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -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;
    }
    }
}
}