Test dynamic_cast for safety from future changes

This commit is contained in:
Ian McInerney 2020-01-13 15:22:26 +00:00
parent 33a40e788b
commit 81ee5edcaf
2 changed files with 6 additions and 2 deletions

View File

@ -289,7 +289,8 @@ public:
{
// Commit any pending in-place edits before the row gets moved out from under
// the editor.
dynamic_cast<WX_GRID*>( GetView() )->CommitPendingChanges( true );
if( auto grid = dynamic_cast<WX_GRID*>( GetView() ) )
grid->CommitPendingChanges( true );
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, m_rows.size() );
GetView()->ProcessTableMessage( msg );

View File

@ -886,7 +886,10 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnUpdateUI( wxUpdateUIEvent& )
if( grid == m_itemsGrid && row == 0 && col == 0 )
{
auto referenceEditor = grid->GetCellEditor( 0, 0 );
SelectReferenceNumber( dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) );
if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
SelectReferenceNumber( textEntry );
referenceEditor->DecRef();
}
}