1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 15:23:48 +01:00

Bug 2282 - Multi-view: Array out of bounds exception (crash)

This commit is contained in:
James Crook
2020-01-09 15:13:36 +00:00
parent 596fd7c02f
commit e047c07a90

View File

@@ -573,8 +573,12 @@ void WaveTrackView::ToggleSubView(WaveTrackDisplay display)
float total = 0;
int greatest = -1;
unsigned nn = 0;
for ( const auto &placement : mPlacements ) {
int removedIndex = foundPlacement.index;
for ( auto &placement : mPlacements ) {
if ( placement.fraction >= 0.0 && placement.index >= 0 ) {
// renumber in case there's an item removed.
if( (removedIndex >= 0) && (placement.index >= removedIndex))
placement.index -= 1;
total += placement.fraction;
greatest = std::max( greatest, placement.index );
++nn;