Avoid crashing on missing tracks in CADSTAR

We can't assume that the ignored connection exists when trying to set
the junction size.  We use int_max for the default instead of 0 so that
later, we don't try to create a minor track with 0 width in loadNets()

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17523
This commit is contained in:
Seth Hillbrand 2024-03-22 10:53:37 -07:00
parent 6b915049d1
commit 00d108498f
1 changed files with 3 additions and 2 deletions

View File

@ -2357,7 +2357,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNets()
auto getJunctionSize = auto getJunctionSize =
[&]( NETELEMENT_ID aJptNetElemId, const NET_PCB::CONNECTION_PCB& aConnectionToIgnore ) -> int [&]( NETELEMENT_ID aJptNetElemId, const NET_PCB::CONNECTION_PCB& aConnectionToIgnore ) -> int
{ {
int jptsize = 0; int jptsize = std::numeric_limits<int>::max();
for( NET_PCB::CONNECTION_PCB connection : net.Connections ) for( NET_PCB::CONNECTION_PCB connection : net.Connections )
{ {
@ -2382,7 +2382,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNets()
} }
} }
if( jptsize == 0 ) if( jptsize == std::numeric_limits<int>::max()
&& !aConnectionToIgnore.Route.RouteVertices.empty() )
{ {
// aConnectionToIgnore is actually the only one that has a route, so lets use that // aConnectionToIgnore is actually the only one that has a route, so lets use that
// to determine junction size // to determine junction size