1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09:28 +02:00

Don't crash in Nyquist tools with mOutputTracks undefined

This commit is contained in:
Paul Licameli 2018-10-04 10:56:03 -04:00
parent 75918918c4
commit df1103822e

View File

@ -646,7 +646,9 @@ bool NyquistEffect::Process()
if ( !bOnePassTool ) if ( !bOnePassTool )
CopyInputTracks(true); CopyInputTracks(true);
mNumSelectedChannels = mOutputTracks->Selected< const WaveTrack >().size(); mNumSelectedChannels = bOnePassTool
? 0
: mOutputTracks->Selected< const WaveTrack >().size();
mDebugOutput.Clear(); mDebugOutput.Clear();
if (!mHelpFile.IsEmpty() && !mHelpFileExists) { if (!mHelpFile.IsEmpty() && !mHelpFileExists) {
@ -769,7 +771,9 @@ bool NyquistEffect::Process()
Effect::MessageBox(message, wxOK | wxCENTRE | wxICON_EXCLAMATION, _("Nyquist Error")); Effect::MessageBox(message, wxOK | wxCENTRE | wxICON_EXCLAMATION, _("Nyquist Error"));
} }
auto trackRange = mOutputTracks->Selected< WaveTrack >() + &Track::IsLeader; Maybe<TrackIterRange<WaveTrack>> pRange;
if (!bOnePassTool)
pRange.create(mOutputTracks->Selected< WaveTrack >() + &Track::IsLeader);
// Keep track of whether the current track is first selected in its sync-lock group // Keep track of whether the current track is first selected in its sync-lock group
// (we have no idea what the length of the returned audio will be, so we have // (we have no idea what the length of the returned audio will be, so we have
@ -777,9 +781,10 @@ bool NyquistEffect::Process()
mFirstInGroup = true; mFirstInGroup = true;
Track *gtLast = NULL; Track *gtLast = NULL;
for (auto &iter = trackRange.first, &end = trackRange.second; for (;
bOnePassTool || iter != end; ++iter) { bOnePassTool || pRange->first != pRange->second;
mCurTrack[0] = *iter; ++pRange->first) {
mCurTrack[0] = pRange ? *pRange->first : nullptr;
mCurNumChannels = 1; mCurNumChannels = 1;
if ( (mT1 >= mT0) || bOnePassTool ) { if ( (mT1 >= mT0) || bOnePassTool ) {
if (bOnePassTool) { if (bOnePassTool) {