Replace check for nullptr

Replace the check for a `nullptr` buffer with a check that checks if the NotePlayHandle uses a buffer. This is effectively the same condition that's used by `PlayHandle::doProcessing` to decide if it should call play with a `nullptr` in the first place. Hence it should be the most fitting check.
This commit is contained in:
Michael Gregorius
2023-09-21 19:24:06 +02:00
parent 6c3ae30c89
commit b6c80bd736

View File

@@ -584,9 +584,9 @@ void InstrumentTrack::playNote( NotePlayHandle* n, sampleFrame* workingBuffer )
// all is done, so now lets play the note!
m_instrument->playNote( n, workingBuffer );
// Calling processAudioBuffer with a nullptr leads to crashes when checking if the buffer represents silence.
// Therefore we must guard against a nullptr here.
if (workingBuffer != nullptr)
// This is effectively the same as checking if workingBuffer is not a nullptr.
// Calling processAudioBuffer with a nullptr leads to crashes. Hence the check.
if (n->usesBuffer())
{
const fpp_t frames = n->framesLeftForCurrentPeriod();
const f_cnt_t offset = n->noteOffset();