More safety for array access.
Fixes https://gitlab.com/kicad/code/kicad/issues/13583
This commit is contained in:
parent
d9e1763484
commit
4e50c5313d
|
@ -764,7 +764,7 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType,
|
||||||
else if( aType & SPT_AC_PHASE )
|
else if( aType & SPT_AC_PHASE )
|
||||||
data_y = m_simulator->GetPhasePlot( (const char*) aName.c_str() );
|
data_y = m_simulator->GetPhasePlot( (const char*) aName.c_str() );
|
||||||
else
|
else
|
||||||
wxASSERT_MSG( false, wxT( "Plot type missing AC_PHASE or AC_MAG bit" ) );
|
wxFAIL_MSG( wxT( "Plot type missing AC_PHASE or AC_MAG bit" ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -775,10 +775,11 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxASSERT_MSG( false, wxT( "Unhandled plot type" ) );
|
wxFAIL_MSG( wxT( "Unhandled plot type" ) );
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxCHECK_MSG( data_y.size() >= size, false, wxT( "No (or not enough) y data values to plot" ) );
|
||||||
|
|
||||||
// If we did a two-source DC analysis, we need to split the resulting vector and add traces
|
// If we did a two-source DC analysis, we need to split the resulting vector and add traces
|
||||||
// for each input step
|
// for each input step
|
||||||
SPICE_DC_PARAMS source1, source2;
|
SPICE_DC_PARAMS source1, source2;
|
||||||
|
|
|
@ -91,7 +91,7 @@ bool SIM_WORKBOOK::AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aTitle,
|
||||||
const wxString& aName, int aPoints, const double* aX, const double* aY,
|
const wxString& aName, int aPoints, const double* aX, const double* aY,
|
||||||
SIM_PLOT_TYPE aType )
|
SIM_PLOT_TYPE aType )
|
||||||
{
|
{
|
||||||
if( aPlotPanel->addTrace( aTitle, aName, aPoints, aX, aY, aType ) )
|
if( aPoints && aPlotPanel->addTrace( aTitle, aName, aPoints, aX, aY, aType ) )
|
||||||
{
|
{
|
||||||
setModified();
|
setModified();
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue