Fix some Pcbnew crashes due to null pointers

This commit is contained in:
jean-pierre charras 2022-02-14 13:46:05 +01:00
parent 0eddbe02c1
commit 876061369b
3 changed files with 5 additions and 3 deletions

View File

@ -624,7 +624,6 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool
wxASSERT( aPlotter != nullptr ); wxASSERT( aPlotter != nullptr );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS ) );
bool fill = aPlotter->GetColorMode();
for( LIB_ITEM& item : m_drawings ) for( LIB_ITEM& item : m_drawings )
{ {

View File

@ -795,7 +795,7 @@ static void isCoupledDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
result->SetDeferredEval( result->SetDeferredEval(
[a, b]() -> double [a, b]() -> double
{ {
NETINFO_ITEM* netinfo = a->GetNet(); NETINFO_ITEM* netinfo = a ? a->GetNet() : nullptr;
wxString coupledNet; wxString coupledNet;
wxString dummy; wxString dummy;

View File

@ -403,7 +403,10 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
const std::shared_ptr<SHAPE> eshape = aPad->GetEffectiveShape( aPad->GetLayer() ); const std::shared_ptr<SHAPE> eshape = aPad->GetEffectiveShape( aPad->GetLayer() );
wxASSERT( eshape->Type() == SH_COMPOUND ); // PTH reduced to only a hole do not return a valid pad shape list
if( eshape->Type() != SH_COMPOUND )
return;
const std::vector<SHAPE*> shapes = const std::vector<SHAPE*> shapes =
static_cast<const SHAPE_COMPOUND*>( eshape.get() )->Shapes(); static_cast<const SHAPE_COMPOUND*>( eshape.get() )->Shapes();