Avoid ngspice segfault

When simulating an empty netlist, calling the `.save all` and `.probe
alli` commands gives a segfault in ngspice.  We can avoid this by
skipping these commands in KiCad.

Fixes https://gitlab.com/kicad/code/kicad/issues/12938
This commit is contained in:
Seth Hillbrand 2022-11-30 15:18:08 -08:00
parent 01cf6d76d8
commit d23f285f8c
1 changed files with 5 additions and 1 deletions

View File

@ -127,7 +127,11 @@ bool NETLIST_EXPORTER_SPICE::DoWriteNetlist( OUTPUTFORMATTER& aFormatter, unsign
writeIncludes( aFormatter, aNetlistOptions );
writeModels( aFormatter );
WriteDirectives( aFormatter, aNetlistOptions );
// Skip this if there is no netlist to avoid an ngspice segfault
if( !m_items.empty() )
WriteDirectives( aFormatter, aNetlistOptions );
writeItems( aFormatter );
WriteTail( aFormatter, aNetlistOptions );