DIALOG_CONFIGURE_PATHS: Fix crash when deleting the last item in list.
When the list (in 3D search path list) contains only one item, when trying to remove this last item, the crash happened.
This commit is contained in:
parent
93b9be7ebe
commit
b7e7d6fd5c
|
@ -413,8 +413,12 @@ void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
|
|||
m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
|
||||
m_SearchPaths->DeleteRows( curRow, 1 );
|
||||
|
||||
m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
|
||||
m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
|
||||
// if there are still rows in grid, make previous row visible
|
||||
if( m_SearchPaths->GetNumberRows() )
|
||||
{
|
||||
m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
|
||||
m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue