pcbnew: Check GetBoard() before using

GetBoard() may return nullptr in the case of a pad that does not belong
yet to the board.
This commit is contained in:
Seth Hillbrand 2019-01-19 19:32:50 -08:00
parent 3526c9a37a
commit 4443487f04
1 changed files with 6 additions and 4 deletions

View File

@ -691,15 +691,17 @@ wxSize D_PAD::GetSolderPasteMargin() const
if( margin == 0 )
margin = module->GetLocalSolderPasteMargin();
BOARD * brd = GetBoard();
auto brd = GetBoard();
if( margin == 0 )
margin = brd->GetDesignSettings().m_SolderPasteMargin;
if( margin == 0 && brd )
{
margin = brd->GetDesignSettings().m_SolderPasteMargin;
}
if( mratio == 0.0 )
mratio = module->GetLocalSolderPasteMarginRatio();
if( mratio == 0.0 )
if( mratio == 0.0 && brd )
{
mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
}