Commit 2099dd70 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix an issue (crash) with very old .brd files.

parents 4121c272 335f5a57
......@@ -118,10 +118,8 @@ private:
void OnPopupMenu( wxCommandEvent& event );
DRC* m_tester;
PCB_EDIT_FRAME* m_Parent;
int m_UnconnectedCount;
};
#endif // _DIALOG_DRC_H_
......
......@@ -11,7 +11,6 @@
class DIALOG_FOOTPRINT_WIZARD_LIST: public DIALOG_FOOTPRINT_WIZARD_LIST_BASE
{
private:
wxDialog * m_Parent;
FOOTPRINT_WIZARD *m_FootprintWizard;
public:
......
......@@ -483,7 +483,8 @@ void LEGACY_PLUGIN::loadGENERAL()
m_board->SetBoundingBox( bbbox );
}
/* Read the number of segments of type DRAW, TRACK, ZONE
/* This is no more usefull, so this info is no more parsed
// Read the number of segments of type DRAW, TRACK, ZONE
else if( TESTLINE( "Ndraw" ) )
{
NbDraw = intParse( line + SZ( "Ndraw" ) );
......@@ -509,6 +510,11 @@ void LEGACY_PLUGIN::loadGENERAL()
m_netCodes.resize( intParse( line + SZ( "Nnets" ) ) );
}
else if( TESTLINE( "Nn" ) ) // id "Nnets" for old .brd files
{
m_netCodes.resize( intParse( line + SZ( "Nn" ) ) );
}
else if( TESTLINE( "$EndGENERAL" ) )
return; // preferred exit
}
......@@ -1823,7 +1829,7 @@ void LEGACY_PLUGIN::loadNETINFO_ITEM()
NETINFO_ITEM* net = NULL;
char* line;
int netCode;
int netCode = 0;
while( ( line = READLINE( m_reader ) ) != NULL )
{
......@@ -1846,6 +1852,11 @@ void LEGACY_PLUGIN::loadNETINFO_ITEM()
if( net != NULL && ( net->GetNet() > 0 || m_board->FindNet( 0 ) == NULL ) )
{
m_board->AppendNet( net );
// Be sure we have room to store the net in m_netCodes
if( (int)m_netCodes.size() <= netCode )
m_netCodes.resize( netCode+1 );
m_netCodes[netCode] = net->GetNet();
}
else
......
......@@ -252,7 +252,6 @@ class SELECT_COPPER_LAYERS_PAIR_DIALOG: public PCB_LAYER_SELECTOR,
public DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
{
private:
BOARD* m_brd;
LAYER_NUM m_frontLayer;
LAYER_NUM m_backLayer;
int m_leftRowSelected;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment