1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-18 09:00:52 +02:00

Fix a null dereference found by Pvs-studio...

... I think the other examples flagged by it are provably redundant
null-checks after uses of pointers, not really bugs
This commit is contained in:
Paul Licameli 2017-10-11 23:07:12 -04:00
parent 31b820b47c
commit 1960762308

View File

@ -4090,9 +4090,9 @@ void AudacityProject::AddImportedTracks(const wxString &fileName,
// remember this to show a warning later // remember this to show a warning later
if (newTrack->GetKind() == WaveTrack::Wave) if (newTrack->GetKind() == WaveTrack::Wave)
{ {
WaveClip* clip = ((WaveTrack*)newTrack)->GetClipByIndex(0); if (WaveClip* clip = ((WaveTrack*)newTrack)->GetClipByIndex(0)) {
BlockArray &blocks = clip->GetSequence()->GetBlockArray(); BlockArray &blocks = clip->GetSequence()->GetBlockArray();
if (clip && blocks.size()) if (blocks.size())
{ {
SeqBlock& block = blocks[0]; SeqBlock& block = blocks[0];
if (block.f->IsAlias()) if (block.f->IsAlias())
@ -4102,6 +4102,7 @@ void AudacityProject::AddImportedTracks(const wxString &fileName,
} }
} }
} }
}
// Automatically assign rate of imported file to whole project, // Automatically assign rate of imported file to whole project,
// if this is the first file that is imported // if this is the first file that is imported