[Bug]: AudioTransportSource::hasStreamFinished nullptr exception
dobrikov91 opened this issue · comments
Sergei commented
Detailed steps on how to reproduce the bug
Juce 7.0.11+
- Create empty
AudioTransportSource
instance - Call
hasStreamFinished
method
App crashes with nullptr exception
All functions except hasStreamFinished()
have nullptr checks, check stacktrace as example
What is the expected behaviour?
hasStreamFinished
should return true in case of missing source
Operating systems
Windows
What versions of the operating systems?
Win10
Architectures
64-bit
Stacktrace
bool AudioTransportSource::hasStreamFinished() const noexcept
{
return positionableSource->getNextReadPosition() > positionableSource->getTotalLength() + 1
&& ! positionableSource->isLooping();
}
void AudioTransportSource::setNextReadPosition (int64 newPosition)
{
if (positionableSource != nullptr)
{
if (sampleRate > 0 && sourceSampleRate > 0)
newPosition = (int64) ((double) newPosition * sourceSampleRate / sampleRate);
positionableSource->setNextReadPosition (newPosition);
if (resamplerSource != nullptr)
resamplerSource->flushBuffers();
}
}
int64 AudioTransportSource::getNextReadPosition() const
{
const ScopedLock sl (callbackLock);
if (positionableSource != nullptr)
{
const double ratio = (sampleRate > 0 && sourceSampleRate > 0) ? sampleRate / sourceSampleRate : 1.0;
return (int64) ((double) positionableSource->getNextReadPosition() * ratio);
}
return 0;
}
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop
branch
The bug is present on the develop
branch
Code of Conduct
- I agree to follow the Code of Conduct