Fix duplicate directives in Spice netlist inside .control ... .endc

Fixes: lp:1812082
https://bugs.launchpad.net/kicad/+bug/1812082
This commit is contained in:
joel-bertrand-JKB 2019-01-16 19:52:35 +01:00 committed by jean-pierre charras
parent 025578fee7
commit 35dc387fc6
1 changed files with 2 additions and 6 deletions

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr * Copyright (C) 1992-2013 jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.TXT for contributors. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -439,6 +439,7 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
else if( lowercaseline.IsSameAs( ".control" ) && ( !controlBlock ) ) else if( lowercaseline.IsSameAs( ".control" ) && ( !controlBlock ) )
{ {
controlBlock = true; controlBlock = true;
m_directives.push_back( line );
} }
else if( lowercaseline.IsSameAs( ".endc" ) && controlBlock ) else if( lowercaseline.IsSameAs( ".endc" ) && controlBlock )
{ {
@ -453,11 +454,6 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
m_directives.push_back( line ); m_directives.push_back( line );
} }
if( controlBlock )
{
m_directives.push_back( line );
}
// Mark directive as started or continued in case it is a multi-line one // Mark directive as started or continued in case it is a multi-line one
directiveStarted = line.StartsWith( '.' ) directiveStarted = line.StartsWith( '.' )
|| ( directiveStarted && line.StartsWith( '+' ) ); || ( directiveStarted && line.StartsWith( '+' ) );