From a27ba65ed2af72d0bb6a3032ac87b0921634312e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 23 Jul 2018 13:56:30 +0200 Subject: [PATCH] DXF import: verify the layer used to import the DXF drawings is valid (correctly selected). --- pcbnew/import_dxf/dialog_dxf_import.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pcbnew/import_dxf/dialog_dxf_import.cpp b/pcbnew/import_dxf/dialog_dxf_import.cpp index c46458aa39..66164ab442 100644 --- a/pcbnew/import_dxf/dialog_dxf_import.cpp +++ b/pcbnew/import_dxf/dialog_dxf_import.cpp @@ -293,6 +293,13 @@ bool DIALOG_DXF_IMPORT::TransferDataFromWindow() // Set coordinates offset for import (offset is given in mm) m_dxfImporter.SetOffset( offsetX, offsetY ); m_layer = m_SelLayerBox->GetLayerSelection(); + + if( m_layer < 0 ) + { + wxMessageBox( _( "Please, select a valid layer " ) ); + return false; + } + m_dxfImporter.SetBrdLayer( m_layer ); m_PCBdefaultLineWidth = getPCBdefaultLineWidthMM(); m_dxfImporter.SetDefaultLineWidthMM( m_PCBdefaultLineWidth );