From 03f79f512c96c9cbc26a06371061fc1d9ee1e574 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 30 Nov 2022 13:56:23 +0000 Subject: [PATCH] Nullptr safety. Fixes https://gitlab.com/kicad/code/kicad/issues/12966 --- pcbnew/board.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 782eaf6496..228b907c38 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -262,10 +262,13 @@ void BOARD::UpdateRatsnestExclusions() GetConnectivity()->RunOnUnconnectedEdges( [&]( CN_EDGE& aEdge ) { - std::pair ids = { aEdge.GetSourceNode()->Parent()->m_Uuid, - aEdge.GetTargetNode()->Parent()->m_Uuid }; + if( aEdge.GetSourceNode() && aEdge.GetTargetNode() ) + { + std::pair ids = { aEdge.GetSourceNode()->Parent()->m_Uuid, + aEdge.GetTargetNode()->Parent()->m_Uuid }; - aEdge.SetVisible( m_ratsnestExclusions.count( ids ) == 0 ); + aEdge.SetVisible( m_ratsnestExclusions.count( ids ) == 0 ); + } return true; } );