From c5c52c3dfd77cb017cb2476b849759efd1d56bf9 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 7 Jun 2018 23:15:10 -0700 Subject: [PATCH] pcbnew Check for valid nodes before drawing ratsnest We can invalidate a node by rotating. Make sure that our endpoints for the ratsnest are valid before attempting to draw. Fixes: lp:1775727 * https://bugs.launchpad.net/kicad/+bug/1775727 --- pcbnew/ratsnest.cpp | 3 +++ pcbnew/ratsnest_viewitem.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 4e33ee235b..1040723dbb 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -115,6 +115,9 @@ void PCB_BASE_FRAME::DrawGeneralRatsnest( wxDC* aDC, int aNetcode ) auto sn = edge.GetSourceNode(); auto dn = edge.GetTargetNode(); + if( !sn->Valid() || !dn->Valid() ) + continue; + bool enable = !sn->GetNoLine() && !dn->GetNoLine(); bool show = sn->Parent()->GetLocalRatsnestVisible() || dn->Parent()->GetLocalRatsnestVisible(); diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp index 522de670b2..27d22b9790 100644 --- a/pcbnew/ratsnest_viewitem.cpp +++ b/pcbnew/ratsnest_viewitem.cpp @@ -109,6 +109,9 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const const VECTOR2I source( sourceNode->Pos() ); const VECTOR2I target( targetNode->Pos() ); + if( !sourceNode->Valid() || !targetNode->Valid() ) + continue; + bool enable = !sourceNode->GetNoLine() && !targetNode->GetNoLine(); bool show = sourceNode->Parent()->GetLocalRatsnestVisible() || targetNode->Parent()->GetLocalRatsnestVisible();