pcbnew: Snap during routing needs active parent

The router items may not yet have a board item parent.  In this case,
the reference to the parent needs to be guarded before dereferencing.

Fixes: lp:1847717
* https://bugs.launchpad.net/kicad/+bug/1847717

(cherry picked from commit 0f8a1c22ad)
This commit is contained in:
Seth Hillbrand 2019-10-11 06:14:42 -07:00 committed by Seth Hillbrand
parent 6506f77689
commit d931bc72c7
1 changed files with 2 additions and 1 deletions

View File

@ -1015,7 +1015,8 @@ bool PNS_KICAD_IFACE::IsItemVisible( const PNS::ITEM* aItem )
auto activeLayers = m_view->GetPainter()->GetSettings()->GetActiveLayers();
bool isHighContrast = m_view->GetPainter()->GetSettings()->GetHighContrast();
if( m_view->IsVisible( item ) && ( !isHighContrast || activeLayers.count( item->GetLayer() ) )
if( item && m_view->IsVisible( item )
&& ( !isHighContrast || activeLayers.count( item->GetLayer() ) )
&& item->ViewGetLOD( item->GetLayer(), m_view ) < m_view->GetScale() )
return true;