Don't set FreeVia when we can't find a net.

Fixes https://gitlab.com/kicad/code/kicad/issues/12421
This commit is contained in:
Jeff Young 2022-09-15 18:35:26 +01:00
parent 19d8dcad8b
commit ce9adeaf51
1 changed files with 13 additions and 9 deletions

View File

@ -3002,17 +3002,27 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
PAD* pad = findPad( via ); PAD* pad = findPad( via );
if( track ) if( track )
{
via->SetNetCode( track->GetNetCode() ); via->SetNetCode( track->GetNetCode() );
via->SetIsFree( false );
}
else if( pad ) else if( pad )
{
via->SetNetCode( pad->GetNetCode() ); via->SetNetCode( pad->GetNetCode() );
via->SetIsFree( false );
}
else else
{
via->SetNetCode( findStitchedZoneNet( via ) ); via->SetNetCode( findStitchedZoneNet( via ) );
via->SetIsFree( via->GetNetCode() > 0 );
}
if( !m_allowDRCViolations && checkDRCViolation( via ) ) if( checkDRCViolation( via ) )
{ {
m_frame->ShowInfoBarError( _( "Via location violates DRC." ), true, m_frame->ShowInfoBarError( _( "Via location violates DRC." ), true,
WX_INFOBAR::MESSAGE_TYPE::DRC_VIOLATION ); WX_INFOBAR::MESSAGE_TYPE::DRC_VIOLATION );
via->SetNetCode( 0 );
if( !m_allowDRCViolations )
return false; return false;
} }
else else
@ -3021,12 +3031,6 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
infobar->Dismiss(); infobar->Dismiss();
} }
if( !track && !pad )
{
via->SetNetCode( findStitchedZoneNet( via ) );
via->SetIsFree();
}
aCommit.Add( via ); aCommit.Add( via );
if( track ) if( track )