Fix crash when drawing item

When drawing before commit, the items do not have a board and therefore
no BDS.  In these cases, take a decent default until committed
This commit is contained in:
Seth Hillbrand 2021-09-07 09:08:44 -07:00
parent d1be35d522
commit c816168e42
1 changed files with 11 additions and 3 deletions

View File

@ -464,9 +464,17 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
if( !item ) if( !item )
return false; return false;
BOARD_DESIGN_SETTINGS& bds = item->GetBoard()->GetDesignSettings(); if( const BOARD* board = item->GetBoard() )
{
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
m_maxError = bds.m_MaxError; m_maxError = bds.m_MaxError;
m_holePlatingThickness = bds.GetHolePlatingThickness(); m_holePlatingThickness = bds.GetHolePlatingThickness();
}
else
{
m_maxError = ARC_HIGH_DEF;
m_holePlatingThickness = 0;
}
// the "cast" applied in here clarifies which overloaded draw() is called // the "cast" applied in here clarifies which overloaded draw() is called
switch( item->Type() ) switch( item->Type() )