Nullptr safety.

Fixes https://gitlab.com/kicad/code/kicad/issues/6862
This commit is contained in:
Jeff Young 2021-01-02 22:25:28 +00:00
parent 7e58f1aa9f
commit f691828c8f
1 changed files with 6 additions and 2 deletions

View File

@ -535,8 +535,12 @@ LIBEVAL::VALUE PCB_EXPR_VAR_REF::GetValue( LIBEVAL::CONTEXT* aCtx )
return PCB_LAYER_VALUE( context->GetLayer() );
}
BOARD_ITEM* item = const_cast<BOARD_ITEM*>( GetObject( aCtx ) );
auto it = m_matchingTypes.find( TYPE_HASH( *item ) );
BOARD_ITEM* item = GetObject( aCtx );
if( !item )
return LIBEVAL::VALUE();
auto it = m_matchingTypes.find( TYPE_HASH( *item ) );
if( it == m_matchingTypes.end() )
{