From ba2d0cdd62026d04c601345e6bd738c7a08d877a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 22 Feb 2021 01:13:38 +0000 Subject: [PATCH] Nullptr safety. --- pcbnew/pcb_expr_evaluator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index da288b2239..f442210541 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -125,7 +125,10 @@ static void isPlated( LIBEVAL::CONTEXT* aCtx, void* self ) PCB_EXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; - if( item->Type() == PCB_PAD_T && dynamic_cast( item )->GetAttribute() == PAD_ATTRIB_PTH ) + if( !item ) + return; + + if( item->Type() == PCB_PAD_T && static_cast( item )->GetAttribute() == PAD_ATTRIB_PTH ) result->Set( 1.0 ); else if( item->Type() == PCB_VIA_T ) result->Set( 1.0 );