From 84d161a4b78bdc1843640166cb61c832ab2370d1 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 6 Jan 2024 22:01:23 +0000 Subject: [PATCH] Don't use referential values as defaults. --- eeschema/sim/sim_model_source.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eeschema/sim/sim_model_source.cpp b/eeschema/sim/sim_model_source.cpp index 6791cf3722..dfbe9d9308 100644 --- a/eeschema/sim/sim_model_source.cpp +++ b/eeschema/sim/sim_model_source.cpp @@ -292,10 +292,14 @@ void SIM_MODEL_SOURCE::doSetParamValue( int aParamIndex, const std::string& aVal { if( GetParam( paramIndex ).value == "" ) { - std::string defaultValue = m_params.at( aParamIndex ).info.defaultValue; + double dummy; + wxString defaultValue = m_params.at( aParamIndex ).info.defaultValue; + + if( !defaultValue.ToDouble( &dummy ) ) + defaultValue = wxT( "0" ); m_params.at( aParamIndex ).value = defaultValue; - SIM_MODEL::SetParamValue( paramIndex, defaultValue ); + SIM_MODEL::SetParamValue( paramIndex, defaultValue.ToStdString() ); } } }