Browse Source

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.
pull/16/head
jean-pierre charras 6 years ago
parent
commit
b7e7d6fd5c
  1. 8
      common/dialogs/dialog_configure_paths.cpp

8
common/dialogs/dialog_configure_paths.cpp

@ -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…
Cancel
Save