From e5b9706f6d194751ad5dc502ef5af0caf0fd6e70 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Tue, 12 Feb 2008 02:44:46 +0000 Subject: [PATCH] Trap bad text layer numbers with DisplayError --- pcbnew/plot_rtn.cpp | 49 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index 8115242198..3f20f06590 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -217,9 +217,18 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, trace_ref = Sel_Texte_Reference; // les 2 autorisations de tracer sont donnees TEXTE_MODULE* text = Module->m_Reference; - int textLayer = text->GetLayer(); + unsigned textLayer = text->GetLayer(); - wxASSERT( (unsigned) textLayer < 32 ); + if( textLayer >= 32 ) + { + wxString errMsg; + + errMsg.Printf( + _("Your BOARD has a bad layer number of %u for module\n %s's \"reference\" text."), + textLayer, Module->GetReference().GetData() ); + DisplayError( this, errMsg ); + goto exit; + } if( ( (1 << textLayer) & masque_layer ) == 0 ) trace_ref = FALSE; @@ -230,7 +239,16 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, text = Module->m_Value; textLayer = text->GetLayer(); - wxASSERT( (unsigned) textLayer < 32 ); + if( textLayer > 32 ) + { + wxString errMsg; + + errMsg.Printf( + _("Your BOARD has a bad layer number of %u for module\n %s's \"value\" text."), + textLayer, Module->GetReference().GetData() ); + DisplayError( this, errMsg ); + goto exit; + } if( ( (1 << textLayer) & masque_layer ) == 0 ) trace_val = FALSE; @@ -265,14 +283,31 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, continue; if( (pt_texte->m_NoShow) && !Sel_Texte_Invisible ) continue; - if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 ) + + textLayer = pt_texte->GetLayer(); + if( textLayer >= 32 ) + { + wxString errMsg; + + errMsg.Printf( + _("Your BOARD has a bad layer number of %u for module\n %s's \"module text\" text of %s."), + textLayer, Module->GetReference().GetData(), pt_texte->m_Text.GetData() ); + DisplayError( this, errMsg ); + goto exit; + } + + if( !( (1<