1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-04 14:39:08 +02:00

Remove unnecessary const_cast

This commit is contained in:
Paul Licameli 2020-01-04 11:59:44 -05:00
parent dffe3155b0
commit 92b857d551

View File

@ -1081,10 +1081,7 @@ int LabelTrackView::GetSelectedIndex( AudacityProject &project ) const
// may make delayed update of mutable mSelIndex after track selection change // may make delayed update of mutable mSelIndex after track selection change
auto track = FindLabelTrack(); auto track = FindLabelTrack();
if ( track->GetSelected() || if ( track->GetSelected() ||
TrackFocus::Get( TrackFocus::Get( project ).Get() == track.get()
// unhappy const_cast because because focus may be set if undefined
const_cast<AudacityProject&>( project )
).Get() == track.get()
) )
return mSelIndex = std::max( -1, return mSelIndex = std::max( -1,
std::min<int>( track->GetLabels().size() - 1, mSelIndex ) ); std::min<int>( track->GetLabels().size() - 1, mSelIndex ) );