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
This commit is contained in:
Seth Hillbrand 2018-06-07 23:15:10 -07:00
parent fb9ccd855d
commit c5c52c3dfd
2 changed files with 6 additions and 0 deletions

View File

@ -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();

View File

@ -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();