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

(cherry picked from commit 32673a0ead)
This commit is contained in:
jean-pierre charras
2025-01-27 18:28:41 +01:00
parent d4f42a7fef
commit a1646bbd6c
+6
View File
@@ -1011,6 +1011,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 );