mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 17:49:45 +02:00
Failsafe against null dereferences if SeqBlock* has a null f.
This commit is contained in:
parent
3aa92e26f3
commit
1f688cfb85
@ -1795,9 +1795,14 @@ bool Sequence::ConsistencyCheck(const wxChar *whereStr)
|
|||||||
bool bError = false;
|
bool bError = false;
|
||||||
|
|
||||||
for (i = 0; i < numBlocks; i++) {
|
for (i = 0; i < numBlocks; i++) {
|
||||||
if (pos != mBlock->Item(i)->start)
|
SeqBlock* pSeqBlock = mBlock->Item(i);
|
||||||
|
if (pos != pSeqBlock->start)
|
||||||
bError = true;
|
bError = true;
|
||||||
|
|
||||||
|
if (pSeqBlock->f)
|
||||||
pos += mBlock->Item(i)->f->GetLength();
|
pos += mBlock->Item(i)->f->GetLength();
|
||||||
|
else
|
||||||
|
bError = true;
|
||||||
}
|
}
|
||||||
if (pos != mNumSamples)
|
if (pos != mNumSamples)
|
||||||
bError = true;
|
bError = true;
|
||||||
@ -1820,18 +1825,26 @@ void Sequence::DebugPrintf(wxString *dest)
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
for (i = 0; i < mBlock->GetCount(); i++) {
|
for (i = 0; i < mBlock->GetCount(); i++) {
|
||||||
|
SeqBlock* pSeqBlock = mBlock->Item(i);
|
||||||
*dest += wxString::Format
|
*dest += wxString::Format
|
||||||
(wxT(" Block %3d: start %8d len %8d refs %d %s"),
|
(wxT(" Block %3d: start %8d, len %8d, refs %d, "),
|
||||||
i,
|
i,
|
||||||
mBlock->Item(i)->start,
|
pSeqBlock->start,
|
||||||
mBlock->Item(i)->f->GetLength(),
|
pSeqBlock->f ? pSeqBlock->f->GetLength() : 0,
|
||||||
mDirManager->GetRefCount(mBlock->Item(i)->f),
|
pSeqBlock->f ? mDirManager->GetRefCount(pSeqBlock->f) : 0);
|
||||||
mBlock->Item(i)->f->GetFileName().GetFullName().c_str());
|
|
||||||
if (pos != mBlock->Item(i)->start)
|
if (pSeqBlock->f)
|
||||||
|
*dest += pSeqBlock->f->GetFileName().GetFullName();
|
||||||
|
else
|
||||||
|
*dest += wxT("<missing block file>");
|
||||||
|
|
||||||
|
if ((pos != pSeqBlock->start) || !pSeqBlock->f)
|
||||||
*dest += wxT(" ERROR\n");
|
*dest += wxT(" ERROR\n");
|
||||||
else
|
else
|
||||||
*dest += wxT("\n");
|
*dest += wxT("\n");
|
||||||
pos += mBlock->Item(i)->f->GetLength();
|
|
||||||
|
if (pSeqBlock->f)
|
||||||
|
pos += pSeqBlock->f->GetLength();
|
||||||
}
|
}
|
||||||
if (pos != mNumSamples)
|
if (pos != mNumSamples)
|
||||||
*dest += wxString::Format
|
*dest += wxString::Format
|
||||||
|
Loading…
x
Reference in New Issue
Block a user