PNS: Only run optimization if lastNode is valid

This commit is contained in:
Jon Evans 2020-12-30 13:44:05 -05:00
parent 79502a0d88
commit b5b64a55ad
1 changed files with 8 additions and 5 deletions

View File

@ -1147,12 +1147,15 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
if( !l.SegmentCount() ) if( !l.SegmentCount() )
{ {
// Do a final optimization to the stored state if( m_lastNode )
NODE::ITEM_VECTOR removed, added; {
m_lastNode->GetUpdatedItems( removed, added ); // Do a final optimization to the stored state
NODE::ITEM_VECTOR removed, added;
m_lastNode->GetUpdatedItems( removed, added );
if( !added.empty() && added.back()->Kind() == ITEM::SEGMENT_T ) if( !added.empty() && added.back()->Kind() == ITEM::SEGMENT_T )
simplifyNewLine( m_lastNode, static_cast<SEGMENT*>( added.back() ) ); simplifyNewLine( m_lastNode, static_cast<SEGMENT*>( added.back() ) );
}
// Nothing to commit if we have an empty line // Nothing to commit if we have an empty line
if( !pl.EndsWithVia() ) if( !pl.EndsWithVia() )