Avoid null access in NGSPICE::AllPlots
This commit is contained in:
parent
2370ca1b0e
commit
f9c7eae63a
|
@ -78,16 +78,20 @@ vector<string> NGSPICE::AllPlots() const
|
||||||
char** allPlots = m_ngSpice_AllVecs( currentPlot );
|
char** allPlots = m_ngSpice_AllVecs( currentPlot );
|
||||||
int noOfPlots = 0;
|
int noOfPlots = 0;
|
||||||
|
|
||||||
|
vector<string> retVal;
|
||||||
if( allPlots != nullptr )
|
if( allPlots != nullptr )
|
||||||
|
{
|
||||||
for( char** plot = allPlots; *plot != nullptr; plot++ )
|
for( char** plot = allPlots; *plot != nullptr; plot++ )
|
||||||
noOfPlots++;
|
noOfPlots++;
|
||||||
|
|
||||||
vector<string> retVal( noOfPlots );
|
retVal.reserve( noOfPlots );
|
||||||
for( int i = 0; i < noOfPlots; i++, allPlots++ )
|
for( int i = 0; i < noOfPlots; i++, allPlots++ )
|
||||||
{
|
{
|
||||||
string vec = *allPlots;
|
string vec = *allPlots;
|
||||||
retVal.at( i ) = vec;
|
retVal.at( i ) = vec;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue