Prevent a crash when a spice SW_I lacks two pin net names
Fixes KICAD-5D
(cherry picked from commit 2cc3d8e9bc
)
This commit is contained in:
parent
981b22ba49
commit
b24ee1c44f
|
@ -42,6 +42,8 @@ std::string SPICE_GENERATOR_SWITCH::ItemLine( const SPICE_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
std::string vsourceName = fmt::format( "V__{}", aItem.refName );
|
std::string vsourceName = fmt::format( "V__{}", aItem.refName );
|
||||||
|
|
||||||
|
wxCHECK_MSG( aItem.pinNetNames.size() >= 2, "", wxS( "Missing two pin net names for SW_I" ) );
|
||||||
|
|
||||||
// Current switches measure input current through a voltage source.
|
// Current switches measure input current through a voltage source.
|
||||||
result.append( fmt::format( "{0} {1} 0\n", aItem.pinNetNames[0], aItem.pinNetNames[1] ) );
|
result.append( fmt::format( "{0} {1} 0\n", aItem.pinNetNames[0], aItem.pinNetNames[1] ) );
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ std::string SPICE_GENERATOR_SWITCH::ItemLine( const SPICE_ITEM& aItem ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_SWITCH" );
|
wxFAIL_MSG( wxS( "Unhandled SIM_MODEL type in SIM_MODEL_SWITCH" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ SIM_MODEL_SWITCH::SIM_MODEL_SWITCH( TYPE aType ) :
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_SWITCH" );
|
wxFAIL_MSG( wxS( "Unhandled SIM_MODEL type in SIM_MODEL_SWITCH" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue