From 7e884e1eb1eaa248a68464629ef61993e7d286a2 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 29 Dec 2013 12:01:54 +0100 Subject: [PATCH] Fix bugs 1264236, 1264238, 1264254 --- common/drawframe.cpp | 2 +- gerbview/class_am_param.cpp | 18 +++++++++++++----- pcbnew/class_track.cpp | 12 +++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/common/drawframe.cpp b/common/drawframe.cpp index 3937a02286..7f170a3d5e 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -636,7 +636,7 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void ) void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList ) { - if( m_messagePanel == NULL && !aList.empty() ) + if( m_messagePanel == NULL ) return; ClearMsgPanel(); diff --git a/gerbview/class_am_param.cpp b/gerbview/class_am_param.cpp index b722a48151..63306a4251 100644 --- a/gerbview/class_am_param.cpp +++ b/gerbview/class_am_param.cpp @@ -71,6 +71,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const double paramvalue = 0.0; double curr_value = 0.0; parm_item_type state = POPVALUE; + for( unsigned ii = 0; ii < m_paramStack.size(); ii++ ) { AM_PARAM_ITEM item = m_paramStack[ii]; @@ -85,12 +86,19 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const case PUSHPARM: // get the parameter from the aDcode - if( aDcode && item.GetIndex() <= aDcode->GetParamCount() ) - curr_value = aDcode->GetParam( item.GetIndex() ); - else // Get parameter from local param definition + if( aDcode ) // should be always true here { - const APERTURE_MACRO * am_parent = aDcode->GetMacro(); - curr_value = am_parent->GetLocalParam( aDcode, item.GetIndex() ); + if( item.GetIndex() <= aDcode->GetParamCount() ) + curr_value = aDcode->GetParam( item.GetIndex() ); + else // Get parameter from local param definition + { + const APERTURE_MACRO * am_parent = aDcode->GetMacro(); + curr_value = am_parent->GetLocalParam( aDcode, item.GetIndex() ); + } + } + else + { + wxLogDebug( wxT( "AM_PARAM::GetValue(): NULL param aDcode\n" ) ); } // Fall through case PUSHVALUE: // a value is on the stack: diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 5b48a8eb0a..21cca65517 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -1154,12 +1154,18 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) LAYER_NUM top_layer, bottom_layer; Via->ReturnLayerPair( &top_layer, &bottom_layer ); - msg = board->GetLayerName( top_layer ) + wxT( "/" ) - + board->GetLayerName( bottom_layer ); + if( board ) + msg = board->GetLayerName( top_layer ) + wxT( "/" ) + + board->GetLayerName( bottom_layer ); + else + msg.Printf(wxT("%d/%d"), top_layer, bottom_layer ); } else { - msg = board->GetLayerName( m_Layer ); + if( board ) + msg = board->GetLayerName( m_Layer ); + else + msg.Printf(wxT("%d"), m_Layer ); } aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );