Eeschema: Fix crash when a netlist is created, if format is not Spice.

This commit is contained in:
jean-pierre charras 2011-04-01 14:12:19 +02:00
parent 8f2f26688f
commit ede820b45f
1 changed files with 13 additions and 4 deletions

View File

@ -100,6 +100,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_CommandStringCtrl = NULL; m_CommandStringCtrl = NULL;
m_TitleStringCtrl = NULL; m_TitleStringCtrl = NULL;
m_IsCurrentFormat = NULL; m_IsCurrentFormat = NULL;
m_AddSubPrefix = NULL;
m_ButtonCancel = NULL; m_ButtonCancel = NULL;
parent->AddPage( this, title, selected ); parent->AddPage( this, title, selected );
@ -411,7 +412,9 @@ void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event )
} }
/* Called when the check box "default format" is clicked /* Called when the check box m_AddSubPrefix
* "default format" is clicked
* ( Spice format only )
*/ */
void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event ) void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
{ {
@ -420,7 +423,7 @@ void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL ) if( CurrPage == NULL || CurrPage->m_AddSubPrefix == NULL )
return; return;
if( CurrPage->m_AddSubPrefix->IsChecked() ) if( CurrPage->m_AddSubPrefix->IsChecked() )
@ -513,8 +516,11 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
else else
g_NetListerCommandLine.Empty(); g_NetListerCommandLine.Empty();
bool addSubPrefix = false;
if( CurrPage->m_AddSubPrefix )
addSubPrefix = CurrPage->m_AddSubPrefix->GetValue();
m_Parent->CreateNetlist( CurrPage->m_IdNetType, dlg.GetPath(), g_OptNetListUseNames, m_Parent->CreateNetlist( CurrPage->m_IdNetType, dlg.GetPath(), g_OptNetListUseNames,
CurrPage->m_AddSubPrefix->GetValue() ); addSubPrefix );
WriteCurrentNetlistSetup(); WriteCurrentNetlistSetup();
@ -602,8 +608,11 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
NETLIST_PAGE_DIALOG* CurrPage; NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
bool addSubPrefix = false;
if( CurrPage->m_AddSubPrefix )
addSubPrefix = CurrPage->m_AddSubPrefix->GetValue();
if( ! m_Parent->CreateNetlist( CurrPage->m_IdNetType, fn.GetFullPath(), if( ! m_Parent->CreateNetlist( CurrPage->m_IdNetType, fn.GetFullPath(),
g_OptNetListUseNames,CurrPage->m_AddSubPrefix->GetValue() ) ) g_OptNetListUseNames,addSubPrefix ) )
return; return;
ExecuteFile( this, ExecFile, CommandLine ); ExecuteFile( this, ExecFile, CommandLine );