diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index 06e65a1ec3..a4e885b86b 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -967,6 +967,9 @@ CONNECTIVITY_DATA::GetRatsnestForItems( const std::vector& aItems ) { RN_NET* net = GetRatsnestForNet( netcode ); + if( !net ) + continue; + for( const CN_EDGE& edge : net->GetEdges() ) { std::shared_ptr srcNode = edge.GetSourceNode(); @@ -992,6 +995,9 @@ const std::vector CONNECTIVITY_DATA::GetRatsnestForPad( const PAD* aPad std::vector edges; RN_NET* net = GetRatsnestForNet( aPad->GetNetCode() ); + if( !net ) + return edges; + for( const CN_EDGE& edge : net->GetEdges() ) { if( edge.GetSourceNode()->Parent() == aPad || edge.GetTargetNode()->Parent() == aPad ) @@ -1017,7 +1023,12 @@ const std::vector CONNECTIVITY_DATA::GetRatsnestForComponent( FOOTPRINT for( int netcode : nets ) { - for( const CN_EDGE& edge : GetRatsnestForNet( netcode )->GetEdges() ) + RN_NET* net = GetRatsnestForNet( netcode ); + + if( !net ) + continue; + + for( const CN_EDGE& edge : net->GetEdges() ) { const std::shared_ptr& srcNode = edge.GetSourceNode(); const std::shared_ptr& dstNode = edge.GetTargetNode(); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 358964b1c3..99b97f65a2 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -1682,6 +1682,10 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent ) // the side of the connectivity on this pad. It also checks for ratsnest points // inside the pad (like a trace end) and counts them. RN_NET* net = connectivity->GetRatsnestForNet( item->GetNetCode() ); + + if( !net ) + continue; + std::vector> anchors; for( const CN_EDGE& edge : net->GetEdges() )