diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 77312c0602..e4c896bc78 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -576,6 +576,9 @@ bool isInsideArea( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox, PCB_EXPR_CONTEX if( !aArea || aArea == aItem || aArea->GetParent() == aItem ) return false; + if( !( aArea->GetLayerSet() & aItem->GetLayerSet() ).any() ) + return false; + BOARD* board = aArea->GetBoard(); std::unique_lock cacheLock( board->m_CachesMutex ); PCB_LAYER_ID layer = aCtx->GetLayer();