Browse Source

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
pull/17/head
Seth Hillbrand 8 years ago
parent
commit
c5c52c3dfd
  1. 3
      pcbnew/ratsnest.cpp
  2. 3
      pcbnew/ratsnest_viewitem.cpp

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

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

Loading…
Cancel
Save