Don't crash if an invalid bus connection is made

Certain situations can trigger the stale cleanup being run
on a bus that doesn't actually contain the stated member.
In this case we should just keep calm and carry on -- who knows
what netlist will be generated, but we shouldn't crash.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8530
This commit is contained in:
Jon Evans 2021-06-01 21:49:25 -04:00
parent 148ac19386
commit 9effeb1fcb
1 changed files with 7 additions and 1 deletions

View File

@ -1908,7 +1908,13 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
{
SCH_CONNECTION* member = matchBusMember( subgraph->m_driver_connection,
stale_member );
wxASSERT( member );
if( !member )
{
wxLogTrace( ConnTrace, "WARNING: failed to match stale member %s in %s.",
stale_member->Name(), subgraph->m_driver_connection->Name() );
continue;
}
wxLogTrace( ConnTrace, "Updating %lu (%s) member %s to %s", subgraph->m_code,
subgraph->m_driver_connection->Name(), member->LocalName(),