Common: Fix -Wcatch-value warnings (catching exceptions by value)

This fixes some warnings on GCC 8.1:

warning: catching polymorphic type ‘class std::out_of_range’ by value [-Wcatch-value=]
         catch( std::out_of_range )
                     ^~~~~~~~~~~~

This fix is along the same lines as:

* ff1802d7a "Fix Coverity "Big parameter passed by value" warnings"
This commit is contained in:
John Beard 2018-06-05 08:38:49 +01:00 committed by Maciej Suminski
parent f95b77b61a
commit 58814e838d
3 changed files with 4 additions and 4 deletions

View File

@ -207,7 +207,7 @@ private:
{
new_layer = aReorderMap.at( orig_layer );
}
catch( std::out_of_range ) {}
catch( const std::out_of_range& ) {}
m_groups[i].first = new_layer;
}
@ -665,7 +665,7 @@ void VIEW::ReorderLayerData( std::unordered_map<int, int> aReorderMap )
{
new_idx = aReorderMap.at( orig_idx );
}
catch( std::out_of_range )
catch( const std::out_of_range& )
{
new_idx = orig_idx;
}

View File

@ -590,7 +590,7 @@ public:
{
return m_layers.at( aLayer ).target == TARGET_CACHED;
}
catch( std::out_of_range )
catch( const std::out_of_range& )
{
return false;
}

View File

@ -165,7 +165,7 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
{
pcbframe = Kiway.Player( FRAME_PCB, true );
}
catch( IO_ERROR err )
catch( const IO_ERROR& err )
{
wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ),
wxOK | wxICON_ERROR, this );