sim - Check FindParam() results before using them

This commit is contained in:
Fabien Corona
2023-02-18 12:54:55 +01:00
parent f5902dad28
commit 5482bc2905
3 changed files with 35 additions and 13 deletions
+8 -2
View File
@@ -28,8 +28,14 @@
std::string SPICE_GENERATOR_R_POT::ModelLine( const SPICE_ITEM& aItem ) const
{
std::string r = m_model.FindParam( "r" )->value->ToSpiceString();
std::string position = m_model.FindParam( "pos" )->value->ToSpiceString();
std::string r = "0";
std::string position = "";
if ( m_model.FindParam( "r" ) )
r = m_model.FindParam( "r" )->value->ToSpiceString();
if ( m_model.FindParam( "pos" ) )
position = m_model.FindParam( "pos" )->value->ToSpiceString();
if( position != "" )
{