diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index 9281f275ed..977ce52d9b 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -427,20 +427,14 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() // Go through all other footprint items for( BOARD_ITEM* boardItem : fp->GraphicalItems() ) { - if( boardItem->Type() == PCB_FP_TEXT_T ) - { - // We are guaranteed to always get an EDA_TEXT in this statement, but we must - // use the dynamic_cast to move through the type tree anyway. - const wxString text = dynamic_cast( boardItem )->GetText(); + KICAD_T itemType = boardItem->Type(); - if( m_references->GetValue() && text == wxT( "${REFERENCE}" ) ) - visitItem( commit, boardItem ); - else if( m_values->GetValue() && text == wxT( "${VALUE}" ) ) - visitItem( commit, boardItem ); - else if( m_otherFields->GetValue() ) + if( itemType == PCB_FP_TEXT_T ) + { + if( m_otherFields->GetValue() ) visitItem( commit, boardItem ); } - else if( boardItem->Type() == PCB_FP_SHAPE_T ) + else if( itemType == PCB_FP_SHAPE_T ) { if( m_footprintGraphics->GetValue() ) visitItem( commit, boardItem );