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