From 4443487f04b5d733ca05aa6c3504dc5855b20151 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 19 Jan 2019 19:32:50 -0800 Subject: [PATCH] pcbnew: Check GetBoard() before using GetBoard() may return nullptr in the case of a pad that does not belong yet to the board. --- pcbnew/class_pad.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 76be6c929a..e343db491c 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -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; }