mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-05 16:43:52 +01:00
Fix infinite loop of error messages trying to draw corrupt project...
... As reported by Steve. Don't throw exceptions when trying only to display a track and the samples can't be found in the database.
This commit is contained in:
@@ -58,8 +58,10 @@ public:
|
|||||||
|
|
||||||
virtual size_t GetSampleCount() const = 0;
|
virtual size_t GetSampleCount() const = 0;
|
||||||
|
|
||||||
|
//! Non-throwing, should fill with zeroes on failure
|
||||||
virtual bool
|
virtual bool
|
||||||
GetSummary256(float *dest, size_t frameoffset, size_t numframes) = 0;
|
GetSummary256(float *dest, size_t frameoffset, size_t numframes) = 0;
|
||||||
|
//! Non-throwing, should fill with zeroes on failure
|
||||||
virtual bool
|
virtual bool
|
||||||
GetSummary64k(float *dest, size_t frameoffset, size_t numframes) = 0;
|
GetSummary64k(float *dest, size_t frameoffset, size_t numframes) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -385,12 +385,21 @@ bool SqliteSampleBlock::GetSummary(float *dest,
|
|||||||
sqlite3_stmt *stmt,
|
sqlite3_stmt *stmt,
|
||||||
size_t srcbytes)
|
size_t srcbytes)
|
||||||
{
|
{
|
||||||
return GetBlob(dest,
|
// Non-throwing, it returns true for success
|
||||||
|
try {
|
||||||
|
// Note GetBlob returns a size_t, not a bool
|
||||||
|
GetBlob(dest,
|
||||||
floatSample,
|
floatSample,
|
||||||
stmt,
|
stmt,
|
||||||
floatSample,
|
floatSample,
|
||||||
frameoffset * 3 * SAMPLE_SIZE(floatSample),
|
frameoffset * 3 * SAMPLE_SIZE(floatSample),
|
||||||
numframes * 3 * SAMPLE_SIZE(floatSample)) / 3 / SAMPLE_SIZE(floatSample);
|
numframes * 3 * SAMPLE_SIZE(floatSample));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch ( const AudacityException & ) {
|
||||||
|
memset(dest, 0, 3 * numframes * sizeof( float ));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double SqliteSampleBlock::GetSumMin() const
|
double SqliteSampleBlock::GetSumMin() const
|
||||||
|
|||||||
Reference in New Issue
Block a user