Eeschema, spice sim: fix a crash when no value is available.
onSimFinished() try to analyse the list of plots, but did not test if there is available data before using it. Fixes #8169 https://gitlab.com/kicad/code/kicad/issues/8169
This commit is contained in:
parent
7c64dba333
commit
e5dd54e05a
|
@ -166,7 +166,7 @@ vector<double> NGSPICE::GetRealPlot( const string& aName, int aMaxLen )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < length; i++ )
|
for( int i = 0; i < length; i++ )
|
||||||
{
|
{
|
||||||
assert( vi->v_compdata[i].cx_imag == 0.0 );
|
wxASSERT( vi->v_compdata[i].cx_imag == 0.0 );
|
||||||
data.push_back( vi->v_compdata[i].cx_real );
|
data.push_back( vi->v_compdata[i].cx_real );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1539,8 +1539,12 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
for( const auto& vec : m_simulator->AllPlots() )
|
for( const auto& vec : m_simulator->AllPlots() )
|
||||||
{
|
{
|
||||||
double val = m_simulator->GetRealPlot( vec, 1 ).at( 0 );
|
std::vector<double> val_list = m_simulator->GetRealPlot( vec, 1 );
|
||||||
|
|
||||||
|
if( val_list.size() == 0 ) // The list of values can be empty!
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double val = val_list.at( 0 );
|
||||||
wxString outLine, signal;
|
wxString outLine, signal;
|
||||||
SIM_PLOT_TYPE type = m_exporter->VectorToSignal( vec, signal );
|
SIM_PLOT_TYPE type = m_exporter->VectorToSignal( vec, signal );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue