7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 19:39:17 +00:00

Pcbnew, router: fix crash when trying to create a blind via without a track

Using PnS router, when trying to create a blind/buried or micro via with layer
selection with no track in progress, the router crashed because the starting
layer was not defined.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19750
This commit is contained in:
jean-pierre charras 2025-01-27 18:28:41 +01:00
parent fccb661487
commit 32673a0ead

View File

@ -1025,6 +1025,12 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia )
// ask the user for a target layer
if( selectLayer )
{
// When the currentLayer is undefined, trying to place a via does not work
// because it means there is no track in progress, and some other variables
// values are not defined like m_endSnapPoint. So do not continue.
if( currentLayer == UNDEFINED_LAYER )
return 0;
wxPoint endPoint = ToWxPoint( view()->ToScreen( m_endSnapPoint ) );
endPoint = frame()->GetCanvas()->ClientToScreen( endPoint );